In my experience, compiling your own HTTP error codes is not the best approach.
I know that HTTP protocol stacks and server-side HTTP protocols handle non-standard HTTP status codes as protocol errors.
Custom code is likely to confuse error messages if they are treated as non-AJAX responses.
Similarly, the use of the phrase βcauseβ of a part of an answer can be problematic. Some server stacks will not allow you to install it, and some client stacks discard it.
My preferred way to report errors in response to an AJAX request is to send a standard code (e.g. 400 - BAD REQUEST) with an XML, JSON, or plain text response body that gives detailed error information. (Be sure to set the title of the response content type ...)
source share