Hacker News new | ask | show | jobs
by dtertman 1430 days ago
The idea described here is implemented in e.g. TikTok's API, and as a consumer of that API (in Java at least), it has been awful to code against.

Because most people abuse status codes, most tooling is built around status codes. All of the Java HTTP libraries, for instance, throw very nice and easily-handle-able exceptions for non-200 status codes, but do nothing at all for 200 codes. So, now, we need to:

* try/catch the call anyway, because it might fail * parse the result * figure out if the result is an error or OK * throw / return early from error results * separate that throw from the try above

It's all so much hassle to avoid a mistake that _client libraries don't make_ : using the wrong URL in the first place.