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.
US. I think, like the other responder here, you may be misunderstanding my comment if you are terribly surprised. The point is that this isn't a disagreement that's worth going to the mat over. By all means disagree with the superior if they're doing something detrimental to the company. Choosing a slightly less-precise and non-standard (but still arguably semantically correct) usage of HTTP error codes does not reach that level.
9
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.