Skip to content
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

bug: improve error message in event push #158

Open
steebchen opened this issue Feb 6, 2024 · 0 comments
Open

bug: improve error message in event push #158

steebchen opened this issue Feb 6, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@steebchen
Copy link
Member

steebchen commented Feb 6, 2024

This should return forbidden only when the query can't find the tenant or the authentication is wrong. Otherwise, the error message should be different and an internal or unavailable error should be returned. This can happen when the database query returns an error (e.g. due to it being unavailable).

if err != nil {
a.l.Debug().Err(err).Msg("error validating tenant token")
return nil, forbidden
}
// get the tenant id
queriedTenant, err := a.config.Repository.Tenant().GetTenantByID(tenantId)
if err != nil {
a.l.Debug().Err(err).Msg("error getting tenant by id")
return nil, forbidden
}

An important part is this line

if err != nil {

as this needs to be checked for a NotFound error, and then it should return a forbidden error if something is off with the jwt, and in all other cases a generic error with a 500 status code

@steebchen steebchen changed the title Improve error handling in event push Improve error message in event push Feb 6, 2024
@steebchen steebchen added bug Something isn't working good first issue Good for newcomers labels Mar 13, 2024
@steebchen steebchen changed the title Improve error message in event push bug: improve error message in event push Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant