Last active
September 20, 2022 12:47
-
-
Save ercnksgl/5e0d3766426416db65152cd2ac04f062 to your computer and use it in GitHub Desktop.
ApiError for sealed classes
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
import androidx.annotation.StringRes | |
import com.ercnksgl.sealedtest.R | |
sealed class ApiError { | |
data class ServerError( | |
val errorBody: String? = null | |
) : ApiError() | |
data class ConnectionError( | |
@StringRes val errorResId: Int = R.string.api_connection_error | |
) : ApiError() | |
data class UnexpectedError( | |
@StringRes val errorResId: Int = R.string.api_unexpected_error | |
) : ApiError() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment