SolidError

sealed class SolidError

The single failure type for every operation in the library.

A SolidError carries a stable machine code, a developer-facing message (diagnostic — not for end users; branch on code and localize that), the originating httpStatus when a server responded, a retryable hint, and the underlying cause when one exists. It replaces the library's former mix of per-feature result types, thrown domain exceptions, nullable returns, and Success(empty)-on-failure.

HTTP responses map to an error exactly once via fromHttp; local throwables via fromThrowable.

Inheritors

Types

Link copied to clipboard
data class AccessDenied(val resourceUri: String, val ownerWebId: String? = null, val message: String = "No access to ") : SolidError

Definitive no-access to a resource; the UI can offer to send an access request.

Link copied to clipboard
data class AccessIndeterminate(val resourceUri: String, val message: String = "Could not verify access to ") : SolidError

Access could not be authoritatively determined (transient); retry rather than deny.

Link copied to clipboard
data object Cancelled : SolidError

The operation was cancelled (coroutine cancellation).

Link copied to clipboard
object Companion
Link copied to clipboard
data class Conflict(val message: String = "Conflict (409).") : SolidError

409 — the request conflicts with the resource's current state.

Link copied to clipboard
data class Forbidden(val message: String = "Forbidden (403).") : SolidError

403 — authenticated but not allowed.

Link copied to clipboard
data class ImpersonationDetected(val notificationUri: String, val claimedActor: String, val actualOwner: String? = null, val message: String = "Notification $notificationUri claims actor=$claimedActor but owner is " + "${actualOwner ?: "unknown"}.") : SolidError

An inbound notification's actor doesn't match the resource owner; it was dropped.

Link copied to clipboard
data class InboxForbidden(val inboxUri: String, val message: String = "Inbox at ") : SolidError

The recipient's inbox returned 403.

Link copied to clipboard
data class InboxUnauthorized(val inboxUri: String, val message: String = "Inbox at ") : SolidError

The recipient's inbox returned 401.

Link copied to clipboard
data class Malformed(val message: String = "Malformed data.", val cause: Throwable? = null) : SolidError

A response body (or local payload) could not be parsed/serialized.

Link copied to clipboard
data class MethodNotAllowed(val message: String = "Method not allowed (405).") : SolidError

405 — the server does not allow this method on the resource.

Link copied to clipboard
data class Network(val cause: Throwable? = null, val message: String = "Network error.") : SolidError

A network I/O failure before a response was obtained; retryable.

Link copied to clipboard
data class NoInbox(val targetWebId: String, val message: String = "No inbox advertised for ") : SolidError

The target agent's profile advertises no ldp:inbox, so a notification can't be delivered.

Link copied to clipboard
data class NotAuthenticated(val message: String = "Not authenticated. Complete sign-in first.") : SolidError

No authorized local session exists for the WebID — complete sign-in first.

Link copied to clipboard
data class NotFound(val message: String = "Not found (404).", val httpStatus: Int = 404) : SolidError

404 / 410 — the resource does not exist.

Link copied to clipboard
data class NotificationDelivery(val inboxUri: String, val status: Int? = null, val message: String = "Notification delivery to $inboxUri failed" + (status?.let { " (HTTP $it)" } ?: "") + ".") : SolidError

A non-auth failure delivering a notification to an inbox.

Link copied to clipboard
data class PreconditionFailed(val message: String = "Precondition failed (412).") : SolidError

412 — an If-Match / If-None-Match precondition failed (the resource changed since it was read). Re-read to obtain a fresh ETag, then retry.

Link copied to clipboard
data class RateLimited(val message: String = "Too many requests (429).") : SolidError

429 — rate limited; retry after a delay.

Link copied to clipboard
data class ServerError(val status: Int, val message: String = "Server error (") : SolidError

5xx — a server-side failure; typically transient.

Link copied to clipboard
data class StaleAcl(val aclUri: String, val message: String = "ACL at ") : SolidError

A conditional ACL/ACR write was rejected (412) by a concurrent change; re-read and retry.

Link copied to clipboard
data class Timeout(val cause: Throwable? = null, val message: String = "Timed out.") : SolidError

A request or connection timed out; retryable.

Link copied to clipboard
data class Tls(val cause: Throwable? = null, val message: String = "TLS failure.") : SolidError

A TLS/certificate failure.

Link copied to clipboard
data class Unauthorized(val message: String = "Unauthorized (401).") : SolidError

401 — no valid credentials for the target (distinct from NotAuthenticated, a missing local session).

Link copied to clipboard
data class UnexpectedResponse(val status: Int, val message: String = "Unexpected response (") : SolidError

A non-success status with no more specific mapping.

Link copied to clipboard
data class Unknown(val message: String = "Unknown error.", val cause: Throwable? = null) : SolidError

Anything with no more specific mapping.

Link copied to clipboard
data class UnsupportedAuthBackend(val resourceUri: String, val backend: String, val message: String = "Auth backend ") : SolidError

The resource's access-control backend isn't supported.

Properties

Link copied to clipboard
open val cause: Throwable? = null

The underlying throwable, when this error wraps one.

Link copied to clipboard
abstract val code: SolidErrorCode

Stable classification; safe to branch on and localize.

Link copied to clipboard
open val httpStatus: Int? = null

The HTTP status that produced this error, or null for local/transport errors.

Link copied to clipboard
abstract val message: String

Developer-facing diagnostic description. Not an end-user string.

Link copied to clipboard
open val retryable: Boolean = false

true when retrying the same request may succeed on its own (transient server/transport conditions). A false value does not mean "never retry" — e.g. PreconditionFailed needs a fresh ETag first (branch on code).

Functions

Link copied to clipboard

Wraps this error in a throwable for getOrThrow-style propagation, preserving cause.