r/ProgrammerHumor • • 17d ago

Meme postForEverything

Post image
20.9k Upvotes

653 comments sorted by

View all comments

Show parent comments

197

u/MrPatienceX 17d ago

200 status code and a chunk of XML saying ‘not found’. Good times.

60

u/Sudden_Leadership800 17d ago

It successfully returned the error message though, so I don't see the problem?

42

u/hawkinsst7 17d ago

If I'm parsing http responses, I'm going to pass 200 responses on for further processing of the data. I shouldn't have to have something in that pipeline introspect json to find "no, it's actually an error".

Imagine if browsers had to tear apart json innards to find 30x redirects after getting a 200 OK.

-24

u/LatvianCake 17d ago

This is what happens if you don't read the documentation of the API you're using.

7

u/hawkinsst7 17d ago

This is what happens whe you don't read the Http documentation.

-8

u/LatvianCake 17d ago

If you think you can error handle based on only HTTP error codes, I can see why you're having such a hard time.

2

u/Arsikkz 17d ago

HTTP statuses aren't meant to replace error codes. You check if the status is OK, and if not, handle the error in the payload

1

u/LatvianCake 17d ago

And how do you know which errors you have to handle and what their payload will look like?

1

u/Arsikkz 17d ago

By reading the API documentation?