-
Notifications
You must be signed in to change notification settings - Fork 573
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
api: Improve http errors #2408
api: Improve http errors #2408
Conversation
@@ -20,11 +19,11 @@ func (f *Frontend) SelectMergeProfile(ctx context.Context, c *connect.Request[qu | |||
ctx = connectgrpc.WithProcedure(ctx, querierv1connect.QuerierServiceSelectMergeProfileProcedure) | |||
tenantIDs, err := tenant.TenantIDs(ctx) | |||
if err != nil { | |||
return nil, connect.NewError(http.StatusBadRequest, err) | |||
return nil, connect.NewError(connect.CodeInvalidArgument, err) |
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 is what paged me today.
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.
LGTM
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.
Like to get the content type situation sorted before merge 🙂
At first, I only wanted to fix some wrong connect error translation but then I realized we have many different ways of doing HTTP errors.
This PR makes sure we use the same function
util.WriteError
orutil.WriteErrorWithStatus
which generates the same HTTP JSON response as the connect API.Fixes #2368