3 ms·
I don't know why you're being downvoted. I think you're completely wrong, but it's not like you're being rude about it. Status codes are not necessarily useful
by pie_flavor 3y ago
I don't know why you're being downvoted. I think you're completely wrong, but it's not like you're being rude about it.
Status codes are not necessarily useful for the developer directly, as they're a second channel for the same information, but they are useful for middleware of all kinds (your argument applies equally to browsers showing errors to users, and the same counterarguments apply to programmers). For example, the HTTP library I'm using has an error_for_status function which conveniently raises a runtime error, without me having to dig into the response to do that manually. Also, if you invent more kinds of errors later, or even if you just haven't published a master table of errors where I can see it, the status code will still let me extract useful semantic information out of an error kind my code has not been written explicitly to handle.