|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ErrorHandler
A hook allowing clients to customize error exceptions for synchronous requests.
Field Summary | |
---|---|
static ErrorHandler |
DEFAULT
An ErrorHandler which returns the original error. |
Method Summary | |
---|---|
Throwable |
handleError(RetrofitError cause)
Return a custom exception to be thrown for a RetrofitError . |
Field Detail |
---|
static final ErrorHandler DEFAULT
ErrorHandler
which returns the original error.
Method Detail |
---|
Throwable handleError(RetrofitError cause)
RetrofitError
. It is recommended that you
pass the supplied error as the cause to any new exceptions.
If the return exception is checked it must be declared to be thrown on the interface method.
Example usage:
class MyErrorHandler implements ErrorHandler { @Override public Throwable handleError(RetrofitError cause) { Response r = cause.getResponse(); if (r != null && r.getStatus() == 401) { return new UnauthorizedException(cause); } return cause; } }
cause
- the original RetrofitError
exception
null
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |