Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "wrong status codes"
-
It's maddening how few people working with the internet don't know anything about the protocols that make it work. Web work, especially, I spend far too much time explaining how status codes, methods, content-types etc work, how they're used and basic fundamental shit about how to do the job of someone building internet applications and consumable services.
The following has played out at more than one company:
App: "Hey api, I need some data"
API: "200 (plain text response message, content-type application/json, 'internal server error')"
App: *blows the fuck up
*msg service team*
Me: "Getting a 200 with a plaintext response containing an internal server exception"
Team: "Yeah, what's the problem?"
Me: "...200 means success, the message suggests 500. Either way, it should be one of the error codes. We use the status code to determine how the application processes the request. What do the logs say?"
Team: "Log says that the user wasn't signed in. Can you not read the response message and make a decision?"
Me: "That status for that is 401. And no, that would require us to know every message you have verbatim, in this case, it doesn't even deserialize and causes an exception because it's not actually json."
Team: "Why 401?"
Me: "It's the code for unauthorized. It tells us to redirect the user to the sign in experience"
Team: "We can't authorize until the user signs in"
Me: *angermatopoeia* "Just, trust me. If a user isn't logged in, return 401, if they don't have permissions you send 403"
Team: *googles SO* "Internet says we can use 500"
Me: "That's server error, it says something blew up with an unhandled exception on your end. You've already established it was an auth issue in the logs."
Team: "But there's an error, why doesn't that work?"
Me: "It's generic. It's like me messaging you and saying, "your service is broken". It doesn't give us any insight into what went wrong or *how* we should attempt to troubleshoot the error or where it occurred. You already know what's wrong, so just tell me with the status code."
Team: "But it's ok, right, 500? It's an error?"
Me: "It puts all the troubleshooting responsibility on your consumer to investigate the error at every level. A precise error code could potentially prevent us from bothering you at all."
Team: "How so?"
Me: "Send 401, we know that it's a login issue, 403, something is wrong with the request, 404 we're hitting an endpoint that doesn't exist, 503 we know that the service can't be reached for some reason, 504 means the service exists, but timed out at the gateway or service. In the worst case we're able to triage who needs to be involved to solve the issue, make sense?"
Team: "Oh, sounds cool, so how do we do that?"
Me: "That's down to your technology, your team will need to implement it. Most frameworks handle it out of the box for many cases."
Team: "Ah, ok. We'll send a 500, that sound easiest"
Me: *..l.. -__- ..l..* "Ok, let's get into the other 5 problems with this situation..."
Moral of the story: If this is you: learn the protocol you're utilizing, provide metadata, and stop treating your customers like shit.22 -
I was reviewing a Pull Request recently and there was this line
`return josn(202, 'Record does not exists')`
I told the developer that, status code and description does not match.
He just did not want to accept that he was wrong and told me that, since this function is not exposed to public, it does not matter.
Whats wrong in accepting that you are wrong. We do make mistakes, consciously or unconsciously. Huur. I regretted reviewing his codes there after.5 -
I reported to our team leader (who is not a developer) that me and my colleague has been having problems with our senior developer whose codes are unmaintainable and messy. I told the team lead that I am losing my trust towards my senior developer and that his codes are messy and not following the coding standards. I was nervous at first because this certain team leader is tight with the senior dev. But still, I expected the team lead to be objective.
I was surprised because the team lead asked me if 'I was perfect' and then the team lead continued to shift the conversation towards me. Team lead then started to compare me with the senior dev which is unfair because I've only been working for 2 years whereas the senior developer has been doing this for 6+ years. Team lead said that I was arrogant. Team lead sent our convo to the other teammates and friends. Team lead told me that I am such a baby.
Fast forward, the senior dev talked to me. Told me that he was busy so he didn't get to improve his codes. Which I dont buy because I often see his discord status as playing during work hours. Told me that it wasnt him. Which I dont know if i should believe since he always lies. Told me that his knowledge is outdated. Told me that maybe because I came from a good university and he did not. He apologized and told me he will improve. Sounds good right?
It's a lie. Because then my friend gave me a recording of his voice ranting about me after our talk. In that recording, he said that I have nothing to prove so I dont get a say. He said that he doesnt care about me. He said that I am cocky. Which I dont understand. I only commented abt his work, why is he attacking me personally? Plus, if someone new like me already already noticed the flaws in his work, what does that say about his skill?
My teammates then asked me to just take the fall lol take note that these teammates were also complaining about this senior dev. they asked me to just give them what they wanted to hear. That I am the one who's wrong and the bosses are right. I said I wanted to defend myself but they hated me for that. They told me to think about what would happen to them. They told me I am selfish. Is it selfish for wanting to defend myself?
I defended myself. I told the senior dev that my intentions are for the right reason. He told me he understands. Later that day, a friend told me he talked behind my back again.
Senior dev told me that the team leader cried because of the words I said. Which i found confusing because it was my own feeling, my own opinion that i am losing trust with this certain senior dev so why would the team lead be so affected by that? Also, i showed our convo to the most objective people i know and they said that i didnt say anything that is offensive nor arrogant I have no control as to how people would react to the words I say. It's beyond me.
I feel so helpless. I told those things to the team lead because I think a team should be open to each other but I was blown out of proportion instead. My friend told me that the team lead and the senior dev are still talking behind my back.
If they do this every time someone tries to speak up, will they ever grow?24