How to retrieve field name raising error in database?
I am using kysely, zod, expressjs. I need to return field error and display it to the end user in frontend form. However I am not sure how to do it with kysely. Code for backend is pretty simple:
and next(err) is catching error and sending it in response with valid status code.
However this is error generated by Kysely:
<Error in second message>
I would be super gratefull if you give me any suggestion how to extract field name raising error.
3 Replies
In fact, this is my first commercial project in node, having previously worked in go and python. And if it's not a problem with kysely, but for example postgres driver then please let me know.
Hey 👋
This is a pg error. refer to their docs.
thanks ❤️