Programming Language

Nocter

A self-contained systems language built around simplicity, encapsulation, and foolproof design.

/development/std/error.nct

error.nct

//! Common error classification API.
//!
//! `error` is the compiler built-in fallible payload type. Error and ErrorCode
//! are ordinary standard-library names that user modules receive through the
//! synthetic prelude.
//!
//! ErrorCode is intentionally open. Standard-library and user-library code use
//! dotted string codes such as "std.io.not_found" or "app.config.missing_key".

pub type ErrorCode = &str
pub type Error = error

pub(nocter) primitive new_error(code: &str, message: &str): error

pub func Error.new(code: ErrorCode, message: &str): Error from code | message {
    return new_error(code, message)
}