Let's say I have a StackOverflow-esque site. I want to post a comment underneath someone's answer. Two things can happen:
1) The comment post is successful. I return the actual formatted DIV as some JSON response, set the JSON.
{
"Success": true,
"Data": "some escaped html to inject"
}
2) The comment post is unsuccessful. I return the error as the JSON response.
{
"Success": false,
"Data": "You can only post every 15 seconds"
}
Is this the correct way to do things? I notice that StackOverflow is returning Apache 500 Internal error
codes when a comment post is unsuccessful, which I find fishy.
Isn't a 500 Internal error
reserved for things that are actually wrong with the server, not just because some comment validation failed?