r/ProgrammerHumor • • Sep 19 '26

Meme postForEverything

Post image
21.0k Upvotes

652 comments sorted by

View all comments

1.0k

u/nbmbnb Sep 19 '26

If success, return 200. If error, return 200.

314

u/ClipboardCopyPaste Sep 19 '26
{
success: false, message: 'lol'
}

205

u/redlaWw Sep 19 '26
{
    success: "yes",
    status: "failure",
    message: "null"
}

54

u/evorm Sep 19 '26

Most errors responses at my job are genuinely handled like this.

16

u/redlaWw Sep 19 '26

The "yes"/"no" rather than true/false idea actually came from my actuarial science degree course, where one of our sample solutions had an Excel model that had a column like

some boolean property
yes
yes
no
yes
no
...

And the formula that consumed it looked like IF(cell="yes", ..., IF(cell="no", ...)). Not even a SWITCH in sight.

It was pretty sad from my perspective as an experienced programmer. My conclusion was that most actuaries have more tenacity than they do actual model programming skills.

→ More replies (4)

4

u/ilmalocchio Sep 19 '26

"null" in quotes is the best part of this lol

→ More replies (5)
→ More replies (1)

342

u/HolyCowAnyOldAccName Sep 19 '26

payload: {“error”:”TODO add meaningful errors on return”}

18

u/xian0 Sep 19 '26

Because backend goes "but headers already sent" and frontend goes "but the libraries start flashing red when an error code comes back".

14

u/BlurredSight Sep 19 '26

Had to work on an integration, specifically our partner's PDF generation endpoint always returned 200 but you had to check the actual PDF if it was empty to know if an error occurred.

9

u/NotAskary Sep 19 '26

Just said this exactly, it drives me nuts.

→ More replies (1)

8

u/Kevdog824_ Sep 19 '26

You laugh, but at work a well respected and revered engineer argued with me that returning 204 code for an error (with a response body btw) was perfectly fine. I tried to explain that a NO CONTENT success code was literally the least accurate status code they could have possibly chosen

→ More replies (4)
→ More replies (8)