1 of 3

I've never seen any API letting the client hanging in case of an error. Also, unless you have a very specific case where this makes sense, this would only result in a practically unusable API.

  • This would slow the development of the client applications. Unless I read very, very carefully the documentation (and the documentation is excellent), I'll make mistakes which would result in timeouts, and thus slow development.

  • This would also make the client apps slow if they cause exceptions when used by an end user.

So no, don't do that.

What you should do is to handle the error gracefully. This means sending a response containing:

  • A specific HTTP code, like 404, 403, 500, etc.

  • The detail explaining what happened. Usually, this shouldn't be the exception itself, since it may contain sensitive information and you may want to provide something more understandable to your users.

  • Eventually the link to the web page of your website which contains additional documentation, examples and workarounds.