-
Notifications
You must be signed in to change notification settings - Fork 59
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
PostgreSQL Error Codes #131
Comments
@adrianolsk, I was also trying to implement mapping db error codes (although for mysql) - Here is the issue (#133). The approach I took was adding the specific database errors: to the response errors object so that it was returned back to the client:
Then, within the appropriate case statements:
This achieves the client error to look like this:
I was looking through the
You could possibly do something similar to this - taken from Objection.js issues (Vincit/objection.js#117) - which also uses
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Apologies if the issue could not be resolved. FeathersJS ecosystem modules are community maintained so there may be a chance that there isn't anybody available to address the issue at the moment. For other ways to get help see here. |
Is there a way to detect the dabase in this file:
feathers-knex/blob/master/src/error-handler.js
?I found the error codes for postgress and would like to map them, but looking in the error object there is nothing to help to identify the database.
https://www.postgresql.org/docs/9.2/static/errcodes-appendix.html
And also how should I implement the errors handlers?
Like I was getting and error about a unique_violation but in the client the error was showing the SQL used to insert.
Should it be something like this?:
new errors.FeathersError(error.detail, error.code, 'unique_violation', error );
The text was updated successfully, but these errors were encountered: