ecma-runtime-cat 0.3.0

ECMAScript runtime: native built-ins (console, Math, JSON, parseInt, isNaN, Promise, ...) that the boa-cat engine exposes to scripts. v0.3.0 adds the `Promise` global with `resolve(v)`, `reject(v)`, `all(arr)`, and `race(arr)` static methods, wrapping the boa-cat 0.6 promise infrastructure (`Heap::alloc_promise`, microtask driver, `.then` / `.catch` dispatch). `Promise.resolve(p)` short-circuits for existing promises per spec; `all` / `race` over fully-settled inputs work synchronously, and the Pending-input orchestration lands once boa-cat ships continuation-passing transforms.
//! Runtime error type.

use boa_cat::Error as EngineError;

/// All errors the runtime can produce.  Currently a thin wrapper around
/// [`boa_cat::Error`] since the runtime itself only contributes native
/// callables whose failures surface as `Outcome::Throw` values rather
/// than `Error`s.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Error {
    /// An error from the boa-cat engine (lex/parse/syntax/fuel/uncaught
    /// exception).
    Engine(EngineError),
}

impl From<EngineError> for Error {
    fn from(value: EngineError) -> Self {
        Self::Engine(value)
    }
}

impl std::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Engine(e) => write!(f, "engine error: {e}"),
        }
    }
}

impl std::error::Error for Error {}