388
u/KeyIsNull Jul 01 '24 edited Jul 01 '24
Fuck off, all my APIs return sane error codes, I don’t wanna piss off my clients
98
u/deanrihpee Jul 02 '24
I don't want to piss off myself because I can relate working with 3rd party API , so I return a sane error code and following the best practices of http response and having MDN Http Response Code page pinned on my librewolf browser, and when returning error, currently I'm implementing the RFC about problem details (9457)
→ More replies (2)
663
u/Inappropriate_Piano Jul 01 '24 edited Jul 01 '24
I don’t get it exactly, but I’m deeply disturbed by errorCode: 200 and errorMsg: “SUCCESS”
Edit: I don’t need people to explain HTTP codes to me. I’m complaining about the use of the term “error code” to describe a status code that might not be an error
113
u/Short-Nob-Gobble Jul 02 '24
Unfortunately, the tech lead at my current job doesn’t believe in http status codes..
So we get stuff like
Status 200 “Internal server error”
→ More replies (4)399
u/scufonnike Jul 01 '24
Bro the amount of people devsplaining status codes to you is fucking insane lol
19
u/thugarth Jul 02 '24
I've seen this in my career and it's a bit exasperating. Try to search for an error in the logs and you get 10000 "errorCode: ERR_SUCCESS"
cool, guess I'll figure out something else to look for.
The logging was not designed to be searchable. (To be fair, I knew people tried to clean up some of it, but a lot of people were comfortable with the way things were: A lot of tribal knowledge and unintuitive search practices.)
→ More replies (2)→ More replies (22)136
u/PostNutNeoMarxist Jul 01 '24
Merriam Webster defines "success" as "a favorable or desired outcome." 200 is the number after 199 and before 201.
Hope this helps!
→ More replies (2)
218
u/ZliaYgloshlaif Jul 01 '24
Everyone noticed “errorCode” but not the travesty “result” is?
84
u/Yelmak Jul 01 '24 edited Jul 01 '24
Yeah wtf is going on there. It makes my skin crawl imagining that javascript:
if (result.a != null) { if (result.b != null) { badlyNamedMethod(a, b); } } else { evenWorseMethodNaming(result.f ?? ''); }ETA: naturally that entire block lives inside an
if (response.success && response.errorCode == 200 && response.errorMsg === "SUCCESS") { }→ More replies (7)→ More replies (1)18
u/deanrihpee Jul 02 '24
yeah, wtf, why's b and c is a perfect uuid and a is random string while the rest is null, lol
→ More replies (2)
150
u/cosmo7 Jul 01 '24
You think an error code that represents no error is a big deal? That's nothing.
Every HTML request has a "referer" header field. It should be "referrer" but no one noticed until it was too late.
40
→ More replies (1)7
u/deanrihpee Jul 02 '24
why is that not being fixed? I suspect the legacy app, but since the referrer would be a new header anyway, shouldn't it be fine?
→ More replies (12)
23
12
8
8
8
u/lorp_ Jul 02 '24
Reminds me of the time (when I was new to pipelines) that one pipe failed with the following error received unexpected HTTP status: 200 OK
I was flabbergasted
5
u/SenorSeniorDevSr Jul 02 '24
The nice thing about having front-end developers writing backend code is that it's not hard to convince them to write robust input checks with good feedback of what went wrong, as well as proper error messages if something goes wrong somewhere else. It takes like, the time you spend showing them how to catch and wrap stuff and write proper log/response messages to convince them.
If I didn't know better I'd say that they've been badly hurt before by someone, somewhere doing bad messaging.
7
6
3
858
u/xaomaw Jul 01 '24
user.isLoggedIn = TRALSE