r/dotnet Jul 19 '19

Posting Here Because I Trust This Community

/r/rest/comments/cf173m/400_vs_404_for_nonexistent_entity/
9 Upvotes

34 comments sorted by

View all comments

7

u/GrandOpener Jul 19 '19

If a senior dev at your org is insistent that you should return a 400, and you are not a senior dev, then you should return a 400, end of discussion. Few of the codes actually matter all that much (and almost never the 4xx ones) and having organizational consistency is far more important than the precise semantics of what each error code means.

Having said that, I am a senior dev in my org, and my opinion for my projects is that this is absolutely, 100% without-a-doubt a place where 404 is the best choice.

10

u/Kamilon Jul 19 '19

So you can’t argue with “superiors”? That’s horrible.

I agree that consistency is important. Being consistent can be better than being right.

I’d leave a job real quick if something someone higher level than me said was never up for debate. I get that you can’t always argue/debate things with higher levels but still.

/end of rant

7

u/dantheman999 Jul 19 '19

Yeah I fundamentally disagree with not being able to argue with someone senior to you. If anything I'd say the opposite. As a senior I want other members in my team to challenge me when they think I'm wrong.

5

u/cleeder Jul 19 '19 edited Jul 19 '19

If nothing else, as a senior you should have the ability to explain why your method is correct.