-
Notifications
You must be signed in to change notification settings - Fork 0
Chore/sentry errors #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Chore/sentry errors #238
Conversation
we currently do not get any error logs besides the general error handler, that does not report to sentry because there is no error wrapping
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some comments and suggestions. Exporting error vars is optional (could make sense, though)
extracted a sctruct because there were too many params separated the actual check from the preparation reported only client errors to sentry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with comments
tenantID, err := openmfpcontext.GetTenantFromContext(ctx) | ||
if err != nil { | ||
return nil, err | ||
if !res.Allowed { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure res
is always not nil
if no error occured?
directive/authorized.go
Outdated
log.Error().Err(err).Str("user", req.TupleKey.User).Msg("authorization check failed") | ||
return nil, err | ||
} | ||
func (ac *authChecker) extractValuesToCheckFromRequest(ctx context.Context, entityParamName string, entityTypeParamName *string, entityType *string) (context.Context, bool, string, string, string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be one of the rare situations where named return values could be useful both for documentation and for preventing returning a lot of "" without knowing what it actually is and returning the (empty) variables instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name extractValue
is a bit misleading as it does extract but also creates a new context?
we currently do not get any error logs besides the general error handler, that does not report to sentry because there is no error wrapping