Share HttpException from the app with the extensions-lib. (#12)

This commit is contained in:
Alessandro Jean 2023-08-18 23:07:06 -03:00 committed by arkon
parent 542ff26701
commit b107ef035e

View File

@ -9,3 +9,12 @@ fun Call.asObservable(): Observable<Response> = throw Exception("Stub!")
fun Call.asObservableSuccess(): Observable<Response> = throw Exception("Stub!")
suspend fun Call.await(): Response = throw Exception("Stub!")
/**
* Exception that handles HTTP codes considered not successful by OkHttp.
* Use it to have a standardized error message in the app across the extensions.
*
* @since extensions-lib 1.5
* @param code [Int] the HTTP status code
*/
class HttpException(val code: Int) : IllegalStateException("HTTP error $code")