Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm with the author here, I've had this conversation with the other devs on my team a few times and each time it lands on 404 if there's no data.. Its just not as useful as the dev who makes the client side applications. Its more convoluted because the server had no error though it returns an error code so as a client side developer, I'm left to decide was my URL invalid and the server really did 404? or was there no payload for the request so I received a 404.

Ideally, the bad paths all are caught during dev-time but that just can't be assumed to always happen, it doesn't account for any of the risk involved with other systems changing and then 404's popping up. It could happen for other unexpected reasons so why should we assume it won't, it seems like we're just covering our eyes to the problem.

for a short example, Imagine a brand-new account was made in a system. should it make some sort of GET request for a specific component of its account that is created asynchronously to the rest of the account creation, eg a 3rd party billing service, and receive a 404 from the server, there are different interpretations that the client could have around this error code! does it mean one such component was truly not created and needs to be? could it be that as a client we know implicitly of this delay and fudge a 404? using 404 as a catch all for these cases seems error prone and less informative than returning the true results of the GET request. I posit that any good client-side software handles 0 results from a request with an empty state, and 1 or more with a results state and 4XX with the error state(s). its more clear, trustworthy and easier to debug.



There’s a 202 response code for “not yet fully created” https://stackoverflow.com/questions/11746894/what-is-the-pro...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: