Manuscript Documentation
v0.1.0

@std/errors.ms#

Error and MissingValue are prelude declarations; explicit imports of them are rejected.

Import other names with import Name from "@std/errors.ms".

Error Interface#

A contract for expected failures that can provide a human-readable message.

Manuscript
interface Error:
    fn message() -> String

Error.message#

Returns a human-readable description of this expected error.

Manuscript
fn message() -> String

ErrorCategory Alternative#

Portable categories for shared standard error cases. Domain errors retain their types and payloads.

Manuscript
type ErrorCategory:
    case InvalidInput
    case InvalidData
    case LimitExceeded
    case NotFound
    case AlreadyExists
    case PermissionDenied
    case Unsupported
    case Closed
    case Timeout
    case Unavailable

ErrorCategory.AlreadyExists#

A requested exclusive resource already exists.

Manuscript
case AlreadyExists

ErrorCategory.Closed#

The resource has been closed.

Manuscript
case Closed

ErrorCategory.InvalidData#

Input data is malformed.

Manuscript
case InvalidData

ErrorCategory.InvalidInput#

Caller input is invalid.

Manuscript
case InvalidInput

ErrorCategory.LimitExceeded#

An operation budget or implementation limit was exceeded.

Manuscript
case LimitExceeded

ErrorCategory.NotFound#

A requested resource was not found.

Manuscript
case NotFound

ErrorCategory.PermissionDenied#

Host authority denied the operation.

Manuscript
case PermissionDenied

ErrorCategory.Timeout#

A local operation or group deadline expired.

Manuscript
case Timeout

ErrorCategory.Unavailable#

The service/resource is unavailable; this does not imply NotFound or PermissionDenied.

Manuscript
case Unavailable

ErrorCategory.Unsupported#

The requested operation is unsupported.

Manuscript
case Unsupported

MissingValue Alternative#

The error Optional.ok_or() returns when no cause is given. Its message names the source file and line of the call.

Manuscript
type MissingValue:
    case Missing(location: String)
Manuscript
impl Error for MissingValue:
    fn message() -> String:

MissingValue.Missing#

Records where the absent value was converted to an error.

Manuscript
case Missing(location: String)

MissingValue.Missing.location#

The calling source position, as file:line.

Manuscript
location: String

MissingValue.Error.message#

Returns “missing value at” followed by the recorded source position.

Manuscript
fn message() -> String:

TextError Alternative#

An error that carries only intentional text, for callers that have no domain error to return.

Manuscript
type TextError:
    case Text(message: String)
Manuscript
impl Error for TextError:
    fn message() -> String:

TextError.Text#

Wraps the human-readable description returned by message().

Manuscript
case Text(message: String)

TextError.Text.message#

Description returned verbatim by message().

Manuscript
message: String

TextError.Error.message#

Returns the wrapped text verbatim.

Manuscript
fn message() -> String:

category Function#

Queries a shared category without changing or invoking the error. Recognized standard cases use their same-name category. Custom errors and domain-specific cases (including Failed, Full, OutputLimit, OutOfRange, AuthenticationFailed and wrapped LogError causes) return none. Messages are never parsed.

Manuscript
fn category(cause: Error) -> Optional[ErrorCategory]: