this post was submitted on 22 Mar 2025
743 points (98.9% liked)

Programmer Humor

21850 readers
1477 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] mmddmm@lemm.ee 84 points 2 days ago (4 children)

And no error message...

I guess that's how it's done. Yeah.

[–] Thorry84@feddit.nl 20 points 2 days ago (1 children)

Doesn't matter, the client ignores the error anyways.

load more comments (1 replies)
[–] PlutoVolcano@lemm.ee 7 points 2 days ago* (last edited 2 days ago)

Getting only a message with no error indicator isn’t much better either

[–] marlowe221@lemmy.world 5 points 2 days ago

Ah, I see you too have run code in Azure Functions…

[–] naught@sh.itjust.works 5 points 2 days ago

This is always how graphql works :)

[–] RizzoTheSmall@lemm.ee 74 points 2 days ago (5 children)

I know an architect who designs APIs this way. Also includes a status code in the response object because why have one status code when you can have two, potentially contradictory, status codes?

[–] boonhet@lemm.ee 49 points 2 days ago (3 children)

I inherited a project where it was essentially impossible to get anything other than 200 OK. Trying to use a private endpoint without logging in? 200 OK unauthorized. Sent gibberish instead of actual request body format? 200 OK bad request. Database connection down? You get the point...

[–] Jerkface@lemmy.world 29 points 2 days ago

It's the HTTP version of "great job."

Computer version of dude wincing through the pain, tears in eyes, giving you a thumbs up.

load more comments (1 replies)
[–] fauxerious@lemmy.world 10 points 2 days ago (1 children)

Lmao do they work at Oracle???

[–] letsgo@lemm.ee 6 points 2 days ago

When I used to work at Oracle every so often a customer would call and complain some function was throwing error "ORA-00000 normal successful completion" and they wanted it filing as a bug and for us to fix it.

I was never quite sure how we were supposed to fix stupid.

[–] ByteJunk@lemmy.world 9 points 2 days ago* (last edited 2 days ago) (4 children)

I may have run in your acquaintance work, stuff along the lines of

200 OK

{ error_code: s23, error_msg: "An error was encountered when performing the operation" }

If you happen to run into him, kindly tackle him in the groin for me.

Thanks!

load more comments (4 replies)
[–] jballs@sh.itjust.works 6 points 2 days ago

Ugh this just reminded me that I ran into this exact issue a couple years ago. We were running jobs every hour to ingest data from an API into our data warehouse. Eventually we got reports from users about having gaps in our data. We dug into it for days trying to find a pattern, but couldn't pinpoint anything. We were just missing random pieces of data, but our jobs never reported any failures.

Eventually we were able to determine the issue. HTTP 200 with "error: true" in the response. Fml

[–] paequ2@lemmy.today 6 points 2 days ago (1 children)

I've seen the status code in a JSON response before: https://cloud.google.com/storage/docs/json_api/v1/status-codes#401-unauthorized

One reason I can think of for including it is that it may make it easier for the consumer to check the status code if it's in the JSON. Depending on how many layers of abstraction you have, your app may not have access to the raw HTTP response.

Although, yeah you lose the single source of truth though.

[–] zalgotext@sh.itjust.works 7 points 2 days ago (1 children)

Depending on how many layers of abstraction you have, your app may not have access to the raw HTTP response.

That sounds like either over-abstraction or bad abstraction then

load more comments (1 replies)
[–] dpflug@kbin.earth 36 points 2 days ago (1 children)

This became a religious war at my last role.

[–] andrefsp@lemmy.world 10 points 2 days ago* (last edited 2 days ago)

I had a similar one at a past work too. A test which was asserting a response status 500.

Like, instead of the test asserting the correct error/status code was being returned, it was instead asserting any error would simply getting masked as a 500.

Basically, asserting the code was buggy....

That made me angry a couple of times but I still miss that place sometimes.

[–] CrackedLinuxISO@lemmy.dbzer0.com 29 points 2 days ago* (last edited 2 days ago) (3 children)

At a prior job, our ~~API~~ load balancers would swallow all errors and return an HTTP 200 response with no content. It was because we had one or two clients with shitty integrations that couldn't handle anything but 200. Of course, they brought in enough money that we couldn't ever force them to fix it on their end.

[–] herrvogel@lemmy.world 27 points 2 days ago

I once worked on a project where the main function would run the entire code in a try-catch block. The catch block did nothing. Just returned 200 OK. Didn't even log the error anywhere. Never seen anything so incredibly frustrating to work on.

[–] bleistift2@sopuli.xyz 5 points 2 days ago (2 children)

Why not POST /to/the/api?withCorrectErrorCodes?

There was nothing RESTful or well planned about this API's interfaces, and the work to do something like that would have been nontrivial. Management never prioritized the work.

load more comments (1 replies)
load more comments (1 replies)
[–] Blackmist@feddit.uk 27 points 2 days ago

Ah, the 200 Go Fuck Yourself pattern.

I use HTTP error codes in my API, and still occasionally see a GET /resource/{"error":"invalid branchID provided"} from people who don't seem to know what they are.

[–] nialv7@lemmy.world 26 points 2 days ago
HTTP 200
{"status": "success", "payload": "{\"error\": true}"}
[–] invertedspear@lemm.ee 19 points 2 days ago (3 children)

Welcome to graphQL. The REST abstraction few need, but everyone wants for some reason.

[–] Donnywholovedbowling@lemmy.world 8 points 2 days ago (2 children)

My team recently migrated to graphql and they don't even do it right. The graphql layer still makes REST calls and then translates them to a gql format, so not only do we get no time or computing savings, we also get the bullshit errors

load more comments (2 replies)
[–] lunarul@lemmy.world 5 points 2 days ago* (last edited 2 days ago)

It make sense for a wrapper layer to do this and I had to fight against APIs that didn't. If I make a single HTTP call that wraps multiple independent API calls into one, then the overall HTTP code should reflect status of the wrapper service, and the individual responses should each have their own code as returned by the underlying services.

For example on one app we needed to get user names by user id for a bunch of users. To optimize this, we batched calls into groups. The API would fail with an error code if one of the user ids in the batch was bad or couldn't be found. That meant we wouldn't be getting data for any of the users in the batch and we didn't know which userId was bad either. Such a call should return 200 for the overall call and individual result for each id, some of which could be errors.

load more comments (1 replies)
[–] jol@discuss.tchncs.de 17 points 2 days ago

Several Favicon APIs do this. Even Google's Favicon endpoint does it, because they return a fallback image. It's pretty annoying.

[–] RecallMadness@lemmy.nz 12 points 2 days ago

Someone GraphQLs

[–] madcaesar@lemmy.world 11 points 2 days ago (1 children)

Here I am preferring 200, with success boolean / message string...

Iike HTTP errors codes for real fuck up's, if I see 500 somethings fucked in the app, otherwise a standardised json response body seems way easier

[–] fuzzzerd@programming.dev 19 points 2 days ago (1 children)

What about both? User supplies bad input? HTTP 400 with response body json describing the error in a standard format?

[–] bountygiver@lemmy.ml 7 points 2 days ago (1 children)

when you are too lazy to ask your request library to not throw exception on non-200 responses.

[–] dan@upvote.au 5 points 2 days ago

Throwing exceptions is fine since errors are an exceptional circumstance (not expected during normal use of the app), and you probably want errors to follow a different code path so that they can be logged, alerts triggered if needed, etc.

[–] Shanmugha@lemmy.world 8 points 2 days ago

I've got better news:

  • notice 200 error:true story on our side
  • fix it
  • fix it better: add detailed description, add message on what needs to be done on client side

Client to mutual users: meh, we see an error, not our problem. Me: screams in swear language

I always loved how Sierra took its error message and turned it into an intentionally quitting the game message because every time they closed the game, instead of closing properly it crashed.

[–] bananoidandroid@feddit.nu 5 points 2 days ago (2 children)

Honestly makes perfect sense.

  1. Message received and successfully parsed.
  2. An error occured while processing request. Ideally they would have a message in the response saying what went wrong if it is relevant for the user.

The problem with only reacting with 500 Internal Server Error is that the user will never improve their input data, if they can do something about it. Responding with 404 is just mean as they wont know if the endpoint is not found or the database couldn't find any data. Differentiating the communication from the processing is i.m.o the best way to do it.

[–] eager_eagle@lemmy.world 44 points 2 days ago (15 children)

That's not what HTTP errors are about, HTTP is a high level application protocol and its errors are supposed to be around access to resources, the underlying QUIC or TCP will handle most lower level networking nuances.

Also, 5xx errors are not about incorrect inputs, that's 4xx.

[–] makuus@pawb.social 26 points 2 days ago (8 children)

…HTTP is a high level application protocol and its errors are supposed to be around access to resources…

I’ve had fellow developers fight me on this point, in much the same way as your parent post.

“If you return a 404 for a record not found, how will I know I have the right endpoint?”

You’ll know you have the right endpoint because I advertised it—in Open API, in docs, etc.

“But, if /users/123 returns a 404, does that mean that the endpoint can’t be found or the record can’t be found?”

Doesn’t matter. That resource doesn’t exist. So, act appropriately.

[–] boonhet@lemm.ee 9 points 2 days ago

Standardize a response body across your APIs that specifies the cause of the non-2xx response. Have an enum per API/service for causes. Include them in the API doc.

If anyone still doesn't get it, quietly dispose of them at your friend's pig farm.

load more comments (7 replies)
load more comments (13 replies)
[–] Olap@lemmy.world 15 points 2 days ago (1 children)

Except of course that http has a myriad of response codes that are more useful than a 200 with an error body. This was a serious mistake of GraphQL imo

[–] dreadbeef@lemmy.dbzer0.com 7 points 2 days ago* (last edited 2 days ago) (3 children)

What's wrong with graphql over a web socket? Graphql doesn't necessitate http or any other transport method, it can be done via pigeons. Graphql has zero control over how http works when you use graphql over http, it doesn't force implementors to use http at all

[–] gnutrino@programming.dev 5 points 2 days ago (1 children)

Aww a whole new generation of devs get to make the same mistakes SOAP made. Makes me feel all fuzzy inside.

load more comments (1 replies)
load more comments (2 replies)
load more comments
view more: next ›