@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.
interface Error:
fn message() -> StringError.message#
Returns a human-readable description of this expected error.
fn message() -> StringErrorCategory Alternative#
Portable categories for shared standard error cases. Domain errors retain their types and payloads.
type ErrorCategory:
case InvalidInput
case InvalidData
case LimitExceeded
case NotFound
case AlreadyExists
case PermissionDenied
case Unsupported
case Closed
case Timeout
case UnavailableErrorCategory.AlreadyExists#
A requested exclusive resource already exists.
case AlreadyExistsErrorCategory.Closed#
The resource has been closed.
case ClosedErrorCategory.InvalidData#
Input data is malformed.
case InvalidDataErrorCategory.InvalidInput#
Caller input is invalid.
case InvalidInputErrorCategory.LimitExceeded#
An operation budget or implementation limit was exceeded.
case LimitExceededErrorCategory.NotFound#
A requested resource was not found.
case NotFoundErrorCategory.PermissionDenied#
Host authority denied the operation.
case PermissionDeniedErrorCategory.Timeout#
A local operation or group deadline expired.
case TimeoutErrorCategory.Unavailable#
The service/resource is unavailable; this does not imply NotFound or PermissionDenied.
case UnavailableErrorCategory.Unsupported#
The requested operation is unsupported.
case UnsupportedMissingValue Alternative#
The error Optional.ok_or() returns when no cause is given. Its message names the source file and line of the call.
type MissingValue:
case Missing(location: String)impl Error for MissingValue:
fn message() -> String:MissingValue.Missing#
Records where the absent value was converted to an error.
case Missing(location: String)MissingValue.Missing.location#
The calling source position, as file:line.
location: StringMissingValue.Error.message#
Returns “missing value at” followed by the recorded source position.
fn message() -> String:TextError Alternative#
An error that carries only intentional text, for callers that have no domain error to return.
type TextError:
case Text(message: String)impl Error for TextError:
fn message() -> String:TextError.Text#
Wraps the human-readable description returned by message().
case Text(message: String)TextError.Text.message#
Description returned verbatim by message().
message: StringTextError.Error.message#
Returns the wrapped text verbatim.
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.
fn category(cause: Error) -> Optional[ErrorCategory]: