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)
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
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.)
I get the reason for having one of them. If the api gateways aren't configured correctly they won't return back the correct http code. I imagine there are proxies or the like that do similar things.
I’m aware of status codes. It bugs me to see it called an error code when there’s no error, even though, as you say, they’re usually only seen when they are an error
In HTTP, codes are returned to indicate the result of a previous request. The codes are standardised. Different ranges of code indicate different issues. The errorMsg is essentially for quick deciphering, because an errorCode of 200 implies that the previous request was properly acknowledged.
200 implies that the previous request was properly acknowledged.
No it does not, it means that the request was successful. Getting any response code back (aside from some instances of code 404) would imply that the server has acknowledged the request, since otherwise it wouldn't have sent anything back.
I unironically have code similar to that in a website I made for my coursework
I made an instagrm-esque social media website, where you can upload up to five images, and the client side code that loads the images into the post looks like that.
if (post.image1){
postDiv.append(post.image1)
if (post.image2) {
postDiv.append(image2)
if (post.image3) {
Something along those lines (where post is an object containing all of the post info)
When you are a beginner, it's easier to copy-paste the same code five times than to think about containers and how to use/loop them.
The moment they need to stop and think: "Oh wait, how many times do I have to ctrl+v this?" (due to it being a dynamic list of unknown size), is the moment they start thinking about other ways, and end up realizing how useful containers are.
Oh come on, you've never designed an API with sequentially named keys on an object to simulate a fixed size ordered list with important information base 64 encoded in key a.
I suspect adding a second, redundant header would significantly increase time to first byte on mobile connections. Alternatively, the bureaucracy probably isn't worth it to fix a typo.
that's true, it just makes me wonder when people make the standard and see the headers with "hmm, yeah, nothing wrong" and then let it alive till today, they even have Referrer-policy something, why!?
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.
Had to work as a consumer of an Accenture product that was exactly like this (it may have been worse, I think there was an error range too like 200-299). What a steamy pile of shit that was (this being just the tip of the shit iceberg).
858
u/xaomaw Jul 01 '24
user.isLoggedIn = TRALSE388
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
663
u/Inappropriate_Piano Jul 01 '24 edited Jul 01 '24
I don’t get it exactly, but I’m deeply disturbed by
errorCode: 200anderrorMsg: “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
218
u/ZliaYgloshlaif Jul 01 '24
Everyone noticed “errorCode” but not the travesty “result” is?
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.
23
u/BrightFleece Jul 01 '24
Task failed successfully
12
u/MariusDelacriox Jul 01 '24
Thank you very much, graphql.
8
u/Dmayak Jul 01 '24
error code != response code
8
u/Olivia512 Jul 02 '24
In GraphQL even failed requests return status code 200
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 OKI 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
u/Staalejonko Jul 01 '24
I'm black&white
6
u/Yhamerith Jul 01 '24
I don't know about it, but it shows sucess: true
So I'm fine with it
3
u/AspieSoft Jul 01 '24
Task failed successfully
3
u/ClinTrc Jul 02 '24
Yesn't
3
u/jnoord001 Jul 02 '24
Friend of mine worked for discover card. He could write pages of sql that would boggle the mind. Sure its a language.
3
u/Maleficent-Region-45 Jul 02 '24
Wait how did you find my firms product?
5
u/scufonnike Jul 01 '24 edited Jul 02 '24
Wtf. In the api contract we all clearly layed out we need responses up to H. Who the fuck approved the pr
2
u/w1na Jul 02 '24
I know someone at work who would totally freak out if they saw this output..
2
u/Stunning_Ride_220 Jul 02 '24
Whoever wrote this is an quadruple nil.
2
u/TheMalware Jul 02 '24
People who dont know People who dont not know
1
u/savageronald Jul 02 '24
Had to work as a consumer of an Accenture product that was exactly like this (it may have been worse, I think there was an error range too like 200-299). What a steamy pile of shit that was (this being just the tip of the shit iceberg).
1
u/Thundechile Jul 02 '24
I remember having a "Partial success" returned from a rest endpoint.
1
u/HeavyPurpose9772 Jul 02 '24
GraphQL issue
1
u/[deleted] Jul 02 '24
return -0;
1
u/Coolengineer7 Jul 02 '24
Status_code = 200
Status_msg = "Status OK"
<body> <text> Error: invalid parameters </text> </body>
1
u/[deleted] Jul 02 '24
Shit code
1
u/AaronTheElite007 Jul 02 '24
1
u/SweetBeanBread Jul 02 '24
Left: Web guys
Right: Unix guys
1
u/[deleted] Jul 02 '24
Ugh
1
u/dizda01 Jul 02 '24
Just a shitty implementation of Result pattern
1
u/[deleted] Jul 02 '24
{
"isNotSuccess": false,
"errorCode": 200,
"errorMsg": "Task failed successfully"
}
1
u/JackNotOLantern Jul 02 '24
Why is it not "responseCode=200" and "responseMessage=SUCCESS"?
1
u/Wave_Walnut Jul 03 '24
not errorcode but returncode
0
u/[deleted] Jul 01 '24
[deleted] — view deleted comment