Best error code for 'generic error'
I'm creating custom error pages for my site. I want one that, if there is a generic error (invalid querystring, improper authentication, etc.) that will be shown. This is easy enough, problem is, what error code would this be? 404 is not found, 403 forbidden.
What code would this best fall under?
Return codes that will be useful to the client.
Bad authentication, 401. Bad request, 400. I'm a teapot, 418.
See RFC 2616 for more information.
There are a series of error codes defined in RFC 2616 for HTTP 1.1 that cover the scenarios you mentioned. For example, in the case of improper authentication, you should probably return code 401 (Unauthorized). In the case of an invalid query string, you might return code 400 (Bad Request).
Look at the RFC itself for the complete list along with some recommendations on when to return which error codes.
IETF: RFC 2616