ape: Improve error messages in ape service #919
Labels
No Label
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 Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#919
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "aarifullin/frostfs-node:feature/ape_errors"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
makes errors more explicit with status AccessDenied.
@ -0,0 +7,4 @@
"git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
)
func apeErr(err error) error {
Minor sugession: APE err is actually an argument, what we do here is add API status, how about
toStatus()
orwrapStatus
or at leasttoStatusErr
?@ -0,0 +13,4 @@
return errAccessDenied
}
type denyingRuleErr struct {
The only thing we do with this type is translate it to string in
apeErr
anyway, why do we need it? We do not use%w
, so we might as well have old wrapper and a new one. This way we won't have 2fmt.Sprintf
.Initally that was for unit-test sake: I want a test to expect only this kind of error (with
require.ErrorAs
) but I think you're right - this does not make a big deal. I removed it andapeErr
->toStatusErr
@ -0,0 +28,4 @@
}
func (d *denyingRuleErr) Error() string {
return fmt.Sprintf("found denying rule for %s: %s", d.method, d.status.String())
WIth
.String()
invocation is done automatically for%s
.You're right - I've forgotten about standard Stringer interface
@aarifullin There is still XX in the commit header
a9bc688233
to79a9631c72
79a9631c72
to19937c67f8
Fixed