square/retrofit — pull request #174 by sberan (2013-03-26 01:26:54+00:00)
Title: Add ErrorHandler for customizing RetrofitError behavior

Add a new interface, ErrorHandler, which is responsible for throwing customized exceptions during synchronous request errors, or directing to the appropriate callback method for asynchronous request errors.

Currently, API users must catch ```RetrofitError``` and try to determine the cause of the error based on certain properties of the HTTP response. This interface allows API clients to expose semantic exceptions to their users.

For example, if I had an API interface method to create a ```User```, I might expose an ```InvalidUserException``` which could be declared on the ```createUser``` method, and used to indicate that something was invalid about the request.

This implementation allows exceptions to be checked or unchecked, leaving that decision up to the API designer. It also doesn't change any existing behavior. Let me know if there's anything I can do to clean it up!