Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156/** Custom error subclasses for programmatic discrimination via `instanceof`. Classes are used here only because `instanceof` is the standard JS idiom for thrown-error discrimination; the rest of the public API is free-function only. @module */
/** Base error class. All other errors from this module extend this one. Wraps an underlying cause via the standard `Error.options.cause`. @example ```ts try { parseTomlEdit({ source: badInput, },); } catch (e) { if (e instanceof TomlEditError) handle(e,); } ``` */export class TomlEditError extends Error { /** Wrap `message` and the optional `cause`. @param message - Human-readable description of the failure. @param options - Standard `ErrorOptions`; pass `{ cause }` to chain an underlying error. @mutates options - Error construction can read caller-owned cause getter or proxy trap through `super`. */ constructor( message: string, options?: ErrorOptions, ) { super( message, options, ); this.name = 'TomlEditError'; }}
/** Thrown when a read or write targets a path that does not exist (and the operation cannot resolve it via path-create). */export class TomlPathNotFoundError extends TomlEditError { /** Wrap `message` and the optional `cause`. @param message - Human-readable description of the missing path. @param options - Standard `ErrorOptions`; pass `{ cause }` to chain an underlying error. @mutates options - Error construction can read caller-owned cause getter or proxy trap through `super`. */ constructor( message: string, options?: ErrorOptions, ) { super( message, options, ); this.name = 'TomlPathNotFoundError'; }}
/** Thrown when a function that requires splice mode (e.g. {@link tomlGetRaw}) is called on a canonical-mode state. */export class TomlSpliceUnavailableError extends TomlEditError { /** Wrap `message` and the optional `cause`. @param message - Human-readable description naming the splice-only API. @param options - Standard `ErrorOptions`; pass `{ cause }` to chain an underlying error. @mutates options - Error construction can read caller-owned cause getter or proxy trap through `super`. */ constructor( message: string, options?: ErrorOptions, ) { super( message, options, ); this.name = 'TomlSpliceUnavailableError'; }}
/** Thrown when a JS value cannot be coerced into a TOML value (e.g. `null`, `undefined`, symbols, functions). */export class TomlTypeError extends TomlEditError { /** Wrap `message` and the optional `cause`. @param message - Human-readable description naming the rejected JS type. @param options - Standard `ErrorOptions`; pass `{ cause }` to chain an underlying error. @mutates options - Error construction can read caller-owned cause getter or proxy trap through `super`. */ constructor( message: string, options?: ErrorOptions, ) { super( message, options, ); this.name = 'TomlTypeError'; }}
/** Thrown when an operation targets an AST shape that the v1 implementation does not support mutating (e.g. overwriting an entire array-of-tables in one shot). Documented in the package's Open risks. */export class TomlImmutableNodeError extends TomlEditError { /** Wrap `message` and the optional `cause`. @param message - Human-readable description naming the unsupported shape. @param options - Standard `ErrorOptions`; pass `{ cause }` to chain an underlying error. @mutates options - Error construction can read caller-owned cause getter or proxy trap through `super`. */ constructor( message: string, options?: ErrorOptions, ) { super( message, options, ); this.name = 'TomlImmutableNodeError'; }}