Created
June 8, 2023 04:41
-
-
Save u0705666/b1992dab6739e51e0f620df657c276a9 to your computer and use it in GitHub Desktop.
ApiResult definiation
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
sealed class ApiResult<out T> { | |
// HTTP 200 | |
data class Success<T>(val data: T) : ApiResult<T>() | |
// HTTP 400..500 | |
data class Failure(val code: Int, val message: String): ApiResult<Nothing>() | |
// Socket timeout, write in Demo, IO, , JSON parsing, NPE etc | |
data class NetworkError(val throwable: Throwable, val message: String, val networkErrorExceptions: ClassifiedNetworkErrorExceptions) : ApiResult<Nothing>() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment