public class SpotifyError extends Exception
To use with asynchronous requests pass SpotifyCallback
instead of Callback
when making the request:
spotify.getMySavedTracks(new SpotifyCallback<Pager<SavedTrack>>() {
public void success(Pager<SavedTrack> savedTrackPager, Response response) {
// handle successful response
}
public void failure(SpotifyError error) {
// handle error
}
});
To use with synchronous requests:
try {
Pager<SavedTrack> mySavedTracks = spotify.getMySavedTracks();
} catch (RetrofitError error) {
SpotifyError spotifyError = SpotifyError.fromRetrofitError(error);
}
Constructor and Description |
---|
SpotifyError(retrofit.RetrofitError retrofitError) |
SpotifyError(retrofit.RetrofitError retrofitError,
ErrorDetails errorDetails,
String message) |
Modifier and Type | Method and Description |
---|---|
static SpotifyError |
fromRetrofitError(retrofit.RetrofitError error) |
ErrorDetails |
getErrorDetails() |
retrofit.RetrofitError |
getRetrofitError() |
boolean |
hasErrorDetails() |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public SpotifyError(retrofit.RetrofitError retrofitError, ErrorDetails errorDetails, String message)
public SpotifyError(retrofit.RetrofitError retrofitError)
public static SpotifyError fromRetrofitError(retrofit.RetrofitError error)
public retrofit.RetrofitError getRetrofitError()
RetrofitError
that was returned for this request.public boolean hasErrorDetails()
ErrorDetails
associated with this error. False otherwise.public ErrorDetails getErrorDetails()