You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more a question than an issue with this module. Whats the best approach for mapping the errors returned from feathers-knex to make it more user friendly to display to the client side? Here is an example, if you have a column:
table.string('col_1').unique();
If you attempt to post to the table and add a value that already exists to col_1 , it returns this to the client:
How do you display a user friendly error message based on the returned object above?
I believe knex returns the specific database driver error and that the error-handler used within feathers-knex is intercepting the error and sending this error object. Knex returns something similar to (for mysql):
Why not send the error.code/errno to the front end and display appropriate message accordingly?
Looking through the error-handler.js code. Within the case statement, where the feathersError is assigned, what if you pass in an additional errors object.
@bsubedi26 , As you closed this issue, I think you have got the solution, can you please provide your solution.
I am also facing same problem , I want the sql error code in error hook context so I can handle common database validation error and send my version of error message.
Please help me as there is no much help available anywhere.
This is more a question than an issue with this module. Whats the best approach for mapping the errors returned from feathers-knex to make it more user friendly to display to the client side? Here is an example, if you have a column:
If you attempt to post to the table and add a value that already exists to
col_1
, it returns this to the client:How do you display a user friendly error message based on the returned object above?
I believe knex returns the specific database driver error and that the error-handler used within feathers-knex is intercepting the error and sending this error object. Knex returns something similar to (for mysql):
Why not send the error.code/errno to the front end and display appropriate message accordingly?
Looking through the
error-handler.js
code. Within the case statement, where the feathersError is assigned, what if you pass in an additional errors object.This results in the response to the client to look like below. You get the additional errors object from the specific database driver you are using:
Please let me know if I am missing something. Thanks in advance.
The text was updated successfully, but these errors were encountered: