fix: move permission denied error to not encounter hash error
@@ -54,6 +54,11 @@ func MapAndFilterErrors(err error, passthrough map[error]bool, mapping map[error
if err == nil {
return nil
}
+
+ if _, ok := err.(authz.PermissionDeniedError); ok {
+ return status.Error(codes.PermissionDenied, err.Error())
+ }
+
if passthrough == nil {
passthrough = ErrorPassthroughSet
}
@@ -66,10 +71,6 @@ func MapAndFilterErrors(err error, passthrough map[error]bool, mapping map[error
return err
}
- if _, ok := err.(authz.PermissionDeniedError); ok {
- return status.Error(codes.PermissionDenied, err.Error())
- }
-
// Map
if mappedErr := mapping[err]; mappedErr != nil {
return mappedErr
