Sandeep Dhami
07/07/2023, 12:23 PMsuspend fun <Success> httpCallV3(job: suspend () -> Success): Success =
try {
job.invoke()
} catch (e: Exception) {
when (e) {
is DomainException -> throw e.cause
is ParsingException,
is ServerException,
is UnauthorizedException,
is UnknownException -> throw e
is IOException -> throw NetworkException(e)
else -> throw UnknownException(e)
}
}