2024-01-18 11:35:52 +00:00
|
|
|
package ape
|
|
|
|
|
|
|
|
import (
|
2024-12-16 11:10:18 +00:00
|
|
|
"errors"
|
|
|
|
|
|
|
|
checkercore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/common/ape"
|
2024-01-18 11:35:52 +00:00
|
|
|
apistatus "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client/status"
|
|
|
|
)
|
|
|
|
|
|
|
|
func toStatusErr(err error) error {
|
2024-12-16 11:10:18 +00:00
|
|
|
var chRouterErr *checkercore.ChainRouterError
|
|
|
|
if !errors.As(err, &chRouterErr) {
|
|
|
|
errServerInternal := &apistatus.ServerInternal{}
|
|
|
|
apistatus.WriteInternalServerErr(errServerInternal, err)
|
|
|
|
return errServerInternal
|
|
|
|
}
|
2024-01-18 11:35:52 +00:00
|
|
|
errAccessDenied := &apistatus.ObjectAccessDenied{}
|
2024-03-11 14:55:50 +00:00
|
|
|
errAccessDenied.WriteReason("ape denied request: " + err.Error())
|
2024-01-18 11:35:52 +00:00
|
|
|
return errAccessDenied
|
|
|
|
}
|