Skip to content

Instantly share code, notes, and snippets.

@Fi5t
Created March 20, 2017 09:16
Show Gist options
  • Save Fi5t/1501b0b5145f09e3d20ee5d7f0fce789 to your computer and use it in GitHub Desktop.
Save Fi5t/1501b0b5145f09e3d20ee5d7f0fce789 to your computer and use it in GitHub Desktop.
...
private fun processServerException(exception: ServerException) {
viewState.showError(exception.description)
when (exception.code) {
ErrorCode.INVALID_CREDENTIALS -> invalidCredentialsCallback()
ErrorCode.AUTHENTICATION_REQUIRED -> authenticationRequiredCallback()
ErrorCode.UNKNOWN -> unknownServerErrorCallback()
}
}
...
open fun invalidCredentialsCallback() {}
open fun authenticationRequiredCallback() {}
open fun unknownServerErrorCallback() {}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment