mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-25 06:58:59 -06:00
fixed the error translation from the statusCodeError type into a corresponding graph api Error representation
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
|
||||
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
"github.com/cs3org/reva/v2/pkg/utils"
|
||||
)
|
||||
|
||||
// FromCS3Status converts a CS3 status code and an error into a corresponding local Error representation.
|
||||
@@ -69,3 +70,12 @@ func FromStat(stat *provider.StatResponse, err error, ignore ...cs3rpc.Code) err
|
||||
// TODO: look into ResourceInfo to get the postprocessing state and map that to 425 status?
|
||||
return FromCS3Status(stat.GetStatus(), err, ignore...)
|
||||
}
|
||||
|
||||
// FromUtilsStatusCodeError returns original error if `err` does not match to the statusCodeError type
|
||||
func FromUtilsStatusCodeError(err error, ignore ...cs3rpc.Code) error {
|
||||
stat := utils.StatusCodeErrorToCS3Status(err)
|
||||
if stat == nil {
|
||||
return FromCS3Status(nil, err, ignore...)
|
||||
}
|
||||
return FromCS3Status(stat, nil, ignore...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user