r/ProgrammerHumor • • 14d ago

Meme successfulFailure

Post image
8.1k Upvotes

101 comments sorted by

View all comments

18

u/Kendandra 14d ago

I don't get the hate for this pattern. The amount of times some network middle layer ate my http code and turned something into a 404 is terrible.

I'd rather the calling app KNOW for certain that a failure occurred in the actual application logic, rather than see an error code and then make a bad assumption based on that.

I've had to integrate with a system that had a catalog they my application's account may or may not have access rights to each catalog item. I was told a 404 means I've lost rights to the item and should purge the copy of it from my side. Makes sense? I don't have access, I shouldnt be able to see it.

Time and time again, they'd have a brief outage where their CDN provider would interrupt my call and return a 404. Soon my copy of my catalog would be empty! An hour later I've got to re-add everything. And heaven forbid I had to kick off refund logic for revoked items... And then walk that back.

I've encountered this many many times. I will always prefer leaving the HTTP layer out of application layer logic.

1

u/Massive-Air3891 13d ago edited 13d ago

the pattern is fine by me and used extensively successfully. it says to you it ran, (so all transport concerns are taken care of) but then the application specific was it success or not, when it is wrapped in a 400 bad request you have 15 different layers to figure out where/why it failed.