KarboneError

sealed interface KarboneError

Every way a Karbone call can fail, as a value.

Inheritors

Types

Link copied to clipboard
sealed interface Api : KarboneError

Errors reported by the Carbone API. message is the raw error text from the response, never rewritten.

Link copied to clipboard
data class BadRequest(val status: Int, val message: String?, val code: String? = null) : KarboneError.Api

HTTP 400 or 422: rejected metadata, invalid JSON, missing field, empty template...

Link copied to clipboard
object Companion
Link copied to clipboard
data class InvalidRequest(val reason: String) : KarboneError

A request rejected client-side before any call.

Link copied to clipboard
data class PayloadTooLarge(val message: String?, val status: Int = HTTP_PAYLOAD_TOO_LARGE, val code: String? = null) : KarboneError.Api

HTTP 413: the template or document sent exceeds Carbone's size limit.

Link copied to clipboard
data class RenderFailed(val message: String?, val status: Int = HTTP_SERVER_ERROR, val code: String? = null) : KarboneError.Api

HTTP 500 on a render endpoint.

Link copied to clipboard
data class RenderNotFound(val id: RenderId, val message: String?, val status: Int = HTTP_NOT_FOUND, val code: String? = null) : KarboneError.Api

HTTP 404 when the requested render id is unknown, expired, or already downloaded once.

Link copied to clipboard
data class Serialization(val cause: Throwable, val body: String?) : KarboneError

A response body that could not be parsed.

Link copied to clipboard
data class TemplateNotFound(val id: TemplateId, val message: String?, val status: Int = HTTP_NOT_FOUND, val code: String? = null) : KarboneError.Api

HTTP 404 when the requested template id is unknown to Carbone.

Link copied to clipboard
data class TemplateRead(val source: TemplateSource.Content, val cause: Throwable) : KarboneError

Local template content could not be read.

Link copied to clipboard
data class Transport(val cause: Throwable) : KarboneError

Connection, timeout or I/O failure.

Link copied to clipboard
data class Unauthorized(val message: String?, val status: Int = HTTP_UNAUTHORIZED, val code: String? = null) : KarboneError.Api

HTTP 401, or a malformed bearer token (carbone-ee answers HTTP 500 "Invalid JSON Web Token").

Link copied to clipboard
data class Unexpected(val status: Int, val message: String?, val body: String?, val code: String? = null) : KarboneError.Api

Any other non-2xx status, or a 2xx with success: false.

Link copied to clipboard
data class UnsupportedTemplateFormat(val message: String?, val status: Int = HTTP_UNSUPPORTED_MEDIA, val code: String? = null) : KarboneError.Api

HTTP 415: Carbone cannot process the template's file format.

Functions

Link copied to clipboard
abstract fun describe(): String

Human-readable summary of this error, used as the message of KarboneException.