Module: core.error

Source: ./core/error.reef


Overview

core.error - Shared structured Error type

Provides a common, structured error representation used across the stdlib (e.g. as Result's error payload). An Error carries a coarse ErrorKind classification, a human-readable message, and an optional numeric code (0 by default).


Types

ErrorKind (enum)

Coarse classification of error causes, shared across stdlib packages.

Variants:

  • NotFound
  • InvalidInput
  • PermissionDenied
  • IoError
  • AlreadyExists
  • Unsupported
  • WouldBlock
  • Timeout
  • OutOfRange
  • Other

Error

A structured error: a classification, a human-readable message, and an optional numeric code (0 when unused).

0.9.2 C2: the fields ARE the read API -- e.kind, e.message, e.code. The error_kind()/error_message()/error_code() accessors are deleted; they wrapped public fields, and a method of the same name would have shadowed the field it returned. Construction still goes through error()/ error_with_code(), which do real work.

Fields:

Name Type
kind ErrorKind
message string
code int

Functions

fn error(kind: ErrorKind, message: string): Error

Constructs an Error with code 0.

fn error_with_code(kind: ErrorKind, message: string, code: int): Error

Constructs an Error with an explicit numeric code.


Generated by reefc doc