zneak
zneak

Reputation: 138071

Is it protocol abuse to report server-side errors through the HTTP status?

I noticed that ColdFusion (version 8 at least) returns the HTTP status code 500 (internal server error) when an uncaught exception occurs in a CFML page. Is this kind of behavior abusing the HTTP status codes, or is it, on the opposite, a nice behavior I should try to reproduce for my other, non-ColdFusion app?

Upvotes: 1

Views: 94

Answers (2)

No it's not abusing, it's a really nice thing to do. AJAX errors are also reported in the status code, description in the body.

Upvotes: 1

Brad
Brad

Reputation: 5488

This is a nice behavior. Especially if you are creating services. Applications consuming your end points can simply check the HTTP status to know if there is an error. Typically, you may also include some text about the error in the body.

Upvotes: 1

Related Questions