Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I realize that this may spur a religious discussion, but I discussed this with friends and get great, but conflicting answers and the actual documentation is of little help.

What does the 500 series response codes mean from the webserver? Internal Server Error, but that is vague. My assumption is that it means that something bad happened to the server (file system corruption, no connection to the database, network issue, etc.) but not specifically a data driven error (divide by zero, record missing, bad parameter, etc).

Something to note, there are some web client implementations (the default Android and Blackberry httpclients) that do not allow access to the html boddy if the server response is 500 so there is no way to determine what caused the issue from the client.

What I have been been implementing recently is a web service that returns a json payload wrapped in a response object that contains more specific error information if it is data related, but the server response will be 200 since it finished the actual processing.

Thoughts?

share|improve this question
add comment

1 Answer 1

In general, 500 means something went wrong on the server-side at no fault of the users. This could be any unexpected exception from your back-end, including the "data driven" errors you talked about.

If the user did something wrong to cause a failure, a 400-level error code should be returned.

share|improve this answer
    
you reinforced my point. I looked through the codes as defined by the w3c for the 400 series [w3.org/Protocols/rfc2616/rfc2616-sec10.html] and I believe that those are for resource issues (not found error or proxy authentication required) but I don't think they fit if the user provides a bad parameter or variable type maybe. –  Bryan Kemp Jun 28 '12 at 3:30
3  
HTTP 400 is BAD REQUEST, which usually gets thrown if the user provides a bad parameter. I find the wikipedia page on HTTP codes a useful reference for this sort of stuff. –  Oleksi Jun 28 '12 at 3:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.