Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Created November 28, 2021 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raamcosta/453cbb546f1fa5912e0772bee11c41a2 to your computer and use it in GitHub Desktop.
Save raamcosta/453cbb546f1fa5912e0772bee11c41a2 to your computer and use it in GitHub Desktop.
sealed interface GetMagicCardUseCaseError
object InvalidCardNameFormat : GetMagicCardUseCaseError
sealed interface ApiCallError : GetMagicCardUseCaseError
class HttpUnsuccessfulCodeError(val httpCode: Int) : ApiCallError
object RemoteServerNotReachedError : ApiCallError
object UnexpectedApiCommunicationError : ApiCallError
fun handleError(error: GetMagicCardUseCaseError) {
when (error) {
is HttpUnsuccessfulCodeError -> //TODO
is RemoteServerNotReachedError -> //TODO
is UnexpectedApiCommunicationError -> //TODO
is InvalidCardNameFormat -> //TODO
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment