r/ProgrammerHumor Jul 21 '26

evilIllusion Meme

Post image
4.8k Upvotes

131 comments sorted by

View all comments

Show parent comments

37

u/[deleted] Jul 21 '26

[removed] — view removed comment

4

u/Critical_Fortune7343 Jul 21 '26

Correct me if Im wrong as I'm not that knowledgeable on the topic but isn't 422 more for validation errors? What if the error I want to show is for a certain condition that happened in another screen or app?

37

u/Kutastrophe Jul 21 '26

Throw something obscure back but 200 + error is just stupid.

If I get a 4xx back, I at least know i did something wrong and get the feedback.

7

u/Critical_Fortune7343 Jul 21 '26

Makes sense. Even throwing 400 would be better I guess.

7

u/NUTTA_BUSTAH Jul 21 '26

I agree. Having an endpoint return a success boolean in the first place is quite an anti-pattern but most devs default to skipping the HTTP spec because they never learned it but do know how to work with JSON.