Last active
October 20, 2018 03:57
-
-
Save timusus/8edd521b8af477e100824b1c99c377ab to your computer and use it in GitHub Desktop.
ResponseMapperSnippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onResponse(call: Call<T>, response: Response<T>) { | |
if (call.isCanceled) return | |
if (response.isSuccessful) { | |
callback(Result.Success(response.body())) | |
} else { | |
callback(Result.Failure(responseErrorMapper?.invoke(response) ?: RemoteServiceHttpError(response))) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment