as Client Exception
suspend fun HttpResponse.asClientException(message: String = "", cause: Throwable? = null): ClientException
Constructs a ClientException based on the HttpResponse
Return
a ClientException with values filled
Parameters
message
optional message to attach to Exception
cause
optional cause as Throwable to attach to Exception if message is not set, it will set the Http response as message.
suspend fun ResponseException.asClientException(message: String = "", cause: Throwable? = null): ClientException
similar to the HttpResponse.asClientException only that it covers the ResponseException thrown by Ktor.
asClientException is an extension function for the ResponseException class, it converts a ResponseException object into a ClientException object.
Return
: a ClientException object that represents the converted error
Parameters
message
: a string that contains a custom error message, it's optional
cause
: a Throwable object that represents the cause of the error, it's optional