-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Raise sqlstate with message
does not return message
(used with custom http status codes).
#2176
Comments
message
does not return `message.message
does not return message
(used with custom http status codes).
IIRC the RAISE sqlstate 'PT452' using
message = 'My Special Status',
detail = 'Quota exceeded',
hint = 'Upgrade your plan'; It would respond with:
I thought this could be used for defining new status codes/messages but perhaps the most useful behavior is to auto-generate the status messages for known status codes(similar to response.status) and leave them blank for unknown status codes. Relevant code: postgrest/src/PostgREST/Error.hs Lines 172 to 182 in dcf7ade
|
That makes sense, I just took a look and indeed the plpgsql
response
This would now make customer http errors have the same fields/format as built in errors. I'm using the Adding the status code would also make it easier to configure error flows too. Interested in your thoughts. |
I see no problem in including the code/message in the body, IIRC it was done that way to avoid having redundant info; and as you mention, it'd better for consistency in client libraries. |
Btw, on #1926 we were trying to normalize the error messages: having them all respond with a "code" field. Some postgrest errors don't include the |
That is a good question actually. On one hand, I could see it return |
Fixed in #1926 |
When I raise an error with
sqlstate
I specify amessage
:However, the
message
does not come along with the response:If I raise with a built in error, the message comes through though:
You can see here:
Would be great to get the
message
specified in theraise
statement when specifying custom http status codes.Thanks!
The text was updated successfully, but these errors were encountered: