In my experience, frontend developers try to avoid 4XX response codes and "hide" error/exception conditions in 2XX responses (e.g. 200, { error: true}).

Why?

7
Share
Share on Mastodon
Share on Twitter
Share on Facebook
Share on Linkedin
mikker

@nateberkopec If I recall correctly, any XHR request that’s not 2XX shows up in red in the console, even when properly handled. Could be that 🤷‍♂️

0
1y
Rasmus Grouleff (he/him)

@nateberkopec I have no idea why. But I do know it makes it really annoying writing clients for APIs that do this.

0
1y
Jason Garber

@nateberkopec Since you’re describing server responses, can you clarify what you mean by “frontend developers” here?

1
1y
Gustavo Garcia

@nateberkopec When I'm making an ajax request to a server and it responds a 404, I'll have a red cross in the bottom of the browser that irritates me.
It feels like an error, but it's not.

1
1y
Gene Chu

@nateberkopec as a frontend engineer I would admit that those fellows have no clue/respect to HTTP response codes. No other reason. No one ever showed them how to properly handle any other responses than 200 and they “invented” a better way 😁

0
1y
In league with the future

@nateberkopec because 4xx implies a client error?

But it might not be a client error so should it be a 5xx?

Or, wait! The system worked perfectly and the client request was fine but something in the internal operations is defined add an error. Is that a 5xx or should I stuff it into a 200 payload?

People are all of lazy, uninformed and have differing priorities.

I think it would be nice to use the status codes consistently. Yet here we are!

1
1y
Damax

@nateberkopec many, many, many people doesn’t know nor understand their medium. Many doesn’t know there are http headers that have meaning.
Just last week before Golden Week, I was puzzled that frontend engineers didn’t understand a filename with an hash (eg: foo.123.js) and the a filename with a query parameters with an hash (foo.js?cache=123).

0
1y
Replies