Wrap some errors with InvalidArgument
status in apemanager
service #1651
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1651
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "aarifullin/frostfs-node:feat/improve_apemngr_errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ErrAPEManagerInvalidArgument
has been introduced for ape-manager serviceInvalidArgument
statusaea6f53edf
to1884ba4ce8
@ -10,2 +10,4 @@
return err
}
func ErrAPEManagerInvalidArgument(msg string) error {
Please write down the motivation for this change. In particular, I am interested in using
status.Error(codes.InvalidArgument...)
vsapemanager_errors.ErrAPEManagerInvalidArgument
status.Error(codes.InvalidArgument...)
- probably, you're talking about the status fromgrpc
-package (used in control services).ErrAPEManagerInvalidArgument
wraps into frostfs-api statusGot it, thanks
@ -82,3 +82,3 @@
var cidSDK cidSDK.ID
if err := cidSDK.DecodeString(cid); err != nil {
return fmt.Errorf("invalid CID format: %w", err)
err = fmt.Errorf("invalid CID format: %w", err)
fmt.Errorf("... %w", err).Error()
is equivalent tofmt.Sprintf("... %v", err)
bdcd6d1b65/src/fmt/print.go (L1063)
bdcd6d1b65/src/fmt/errors.go (L31)
For
%s
it is even easier.fixed to
%s
That is not what I wanted to say:
is equivalent to
So no intermediate error (via
fmt.Errorf
) is needed.The same could be done in multiple other places in this PR
Ah. Okay. Fixed
1884ba4ce8
to6c38deb36b
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
New commits pushed, approval review dismissed automatically according to repository settings
6c38deb36b
toe65d8666c7
@ -194,3 +194,3 @@
target = policy_engine.ContainerTarget(reqCID)
default:
return nil, fmt.Errorf("unsupported target type: %s", targetType)
return nil, apemanager_errors.ErrAPEManagerInvalidArgument(fmt.Sprintf("unsupported target type: %s", targetType))
4 lines above we also return an error, but do not wrap it, why?
validateContainerTargetRequest
?You can see it already wraps errors within
I know this is not a good approach when you wrap errors within call. But
validateContainerTargetRequest
is the internal method used only in ape-manager anywayErrAPEManagerInvalidArgument
andErrAPEManagerAccessDenied
In this case I suppose it's not worth it