ClientHttpHandler - Exceptions and Http Codes

11 views
Skip to first unread message

Daniel Worthington-Bodart

unread,
Sep 1, 2014, 4:24:09 AM9/1/14
to utterlyidle
Hi people,

Currently we have the following mapping if an exception is thrown inside the ClientHttpHandler:
  • SocketException -> 503 Connection Refused
  • SocketTimeoutException -> 504 Client Timeout
  • TimeoutException -> 504 Client Timeout
  • FileNotFoundException -> 404 File not found
  • Anything else propagates
What I'd like to do is change all the 50x errors to be 400 errors (the original thinking was map them to the same proxy gateway error but with hindsight it seems the Client timeout (and others) should be a client error!

FileNotFoundException would stay the same but the others would map as follows:
  • Exception ex -> 400 ex.toString()
For example a read timeout would look like this:
  • SocketTimeoutException -> 400 java.net.SocketTimeoutException: Read time out
NB: On Friday I already made the entity body be the full stack trace.

The idea being that any exception being throw comes from the client much like any exception on the server results in a 500 error.

Ideally I should also make the server code also change the status description to contain the exception.

Unless anyone one complains I'm going to make this change shortly.

Dan
Reply all
Reply to author
Forward
0 new messages