More verbose errors for the client
Closed this issue · 2 comments
ronkorving commented
When edit() throws, it's quite likely that there was an input validation error. It's often vital that an error message is communicated back to the client (eg: "No name was provided"). We don't want to output a stack or anything, but error.message
seems very reasonable. Perhaps text/plain is more appropriate here than a JSON object.
If an error object is thrown and it has a code
property, we could add a response header: x-error-code
for example, so clients can also programmatically deal with these errors.
axit-joost commented
Ooh, I would every much like that. Code for code, messages for people.
ronkorving commented
I kinda expected you would say that. So I went ahead and implemented #22