Add error code to error object

Could you add an error code to the error object? Currently, the only thing usefull is a string (.message). But I have to translate the error message. So I now check on (a part of) the string (e.g. “validation failed”), but if you ever decide to change this part of the message, my code breaks.