-
Notifications
You must be signed in to change notification settings - Fork 324
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
feature: bubble up specific publicly accessible Postgres error messages #404
Conversation
…es error if available
542b028
to
433af12
Compare
I can confirm that this PR fixes issue #271 |
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.
Hey @bnjmnt4n, sry this took awhile to review but as @silentworks mentioned, we've tested it out on before / after triggers and it bubbles up the error successfully! :) One thing to note is that if the trigger doesn't raise an exception and fails because of some other reason (e.g. integrity constraint violations) then gotrue still returns an internal server error (500).
I'm leaning towards bubbling up the error returned from the trigger if it is due to an integrity constraint violation. Let me know what you think?
hey @bnjmnt4n, thanks for your contribution to resolve this issue once again! I'm gonna push ahead with some of these changes and get it in first - feel free to follow up with an issue if you think any additional error codes should be included. |
🎉 This PR is included in version 2.6.34 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What kind of change does this PR introduce?
Feature.
What is the current behavior?
Exceptions raised in Postgres when interacting with the database are not bubbled up to the endpoints, leaving the endpoints returning more generic error messages. See #271.
What is the new behavior?
If an error is returned, which either is a plain
raise exception "message"
call, or has a format like https://postgrest.org/en/v9.0/api.html#raise-errors-with-http-status-codes, the error message and related information will be passed up to the endpoint. This occurs for both the JSON endpoints, and for the OAuth redirect for error messages.All other Postgres error types are considered internal and will not be exposed.
Additional context
Closes #271.