Package-level declarations

Handling errors in HTTP responses.

See documentation.

Types

Link copied to clipboard
open class AuthenticationException(message: String = "Unauthorized", status: HttpStatusCode = HttpStatusCode.Unauthorized, response: Response? = null) : HttpException

Thrown on HTTP response for an unauthenticated request, i.e. missing credentials (usually HttpStatusCode.Unauthorized).

Link copied to clipboard
open class AuthorizationException(message: String = "Forbidden", status: HttpStatusCode = HttpStatusCode.Forbidden, response: Response? = null) : HttpException

Thrown on HTTP response for an unauthorized request, i.e. missing permissions (usually HttpStatusCode.Forbidden).

Link copied to clipboard
open class BadRequestException(message: String = "Bad request", status: HttpStatusCode = HttpStatusCode.BadRequest, response: Response? = null) : HttpException

Thrown on HTTP response for a bad request (usually HttpStatusCode.BadRequest).

Link copied to clipboard
open class ConcurrencyException(message: String = "Precondition failed", status: HttpStatusCode = HttpStatusCode.PreconditionFailed, response: Response? = null) : HttpException

Thrown on HTTP response for a failed precondition or mid-air collision (usually HttpStatusCode.PreconditionFailed).

Link copied to clipboard
open class ConflictException(message: String = "Conflict", status: HttpStatusCode = HttpStatusCode.Conflict, response: Response? = null) : HttpException

Thrown on HTTP response for a resource conflict (usually HttpStatusCode.Conflict).

Link copied to clipboard

Handles errors in HTTP responses by mapping status codes to common exception types.

Link copied to clipboard
interface ErrorHandler

Handles errors in HTTP responses.

Link copied to clipboard
open class HttpException(message: String, val status: HttpStatusCode, val response: Response? = null) : Exception

Thrown on HTTP response with a non-successful status code (4xx or 5xx).

Link copied to clipboard
open class NotFoundException(message: String = "Not found", status: HttpStatusCode = HttpStatusCode.NotFound, response: Response? = null) : HttpException

Thrown on HTTP response for a missing resource (usually HttpStatusCode.NotFound or HttpStatusCode.Gone).

Link copied to clipboard
open class TimeoutException(message: String = "Timeout", status: HttpStatusCode = HttpStatusCode.RequestTimeout, response: Response? = null) : HttpException

Thrown on HTTP response for a timed-out operation (usually HttpStatusCode.RequestTimeout).