Skip to content

Errors ​

The built-in error classes.

Always available

No import needed. These names are in scope in every file.

Error class ​

ts
class Error

Base error class. Throwing any value works, but Error is the conventional carrier for human-readable failures: it captures the call stack at construction and renders cleanly in console.error.

message is the user-supplied description. name is "Error" (overridden by each subclass). stack is a multi-line trace captured at construction, prefixed with name: message.

Error.message ​

ts
message: string

Human-readable description passed to the constructor.

Error.name ​

ts
readonly name: string

Class name. "Error" for the base, overridden per subclass.

Error.stack ​

ts
readonly stack: string

Multi-line stack trace captured at construction time.

new Error() ​

ts
constructor(message?: string)

Construct an error with an optional message.

TypeError class ​

ts
class TypeError extends Error

Thrown when a value is not of the expected type. Idiomatic for argument validation in user code; the runtime itself raises TypeError for things like calling a non-callable or indexing a non-collection.

ts
constructor(message?: string)

RangeError class ​

ts
class RangeError extends Error

Thrown when a numeric or collection value is outside the legal range. The runtime emits RangeError for integer overflow, division by zero, out-of-range numeric conversions, and stdlib helpers like Random.nextInt(min, max) when min > max.

ts
constructor(message?: string)

SyntaxError class ​

ts
class SyntaxError extends Error

Thrown when a value cannot be parsed as valid syntax. Most often surfaced by JSON.parse and other text-format readers. The ThicketScript parser itself reports source-level syntax errors as compiler diagnostics, not runtime exceptions.

ts
constructor(message?: string)

ReferenceError class ​

ts
class ReferenceError extends Error

Thrown when a referenced binding does not exist. Raised by the VM for unresolved global lookups; user code may throw it to flag a missing key or handler by name.

ts
constructor(message?: string)

PermissionError class ​

ts
class PermissionError extends Error

Thrown by a native system call when its required root-project permission is absent. The message names the permission and explains the thicket.json grant needed to enable it.

ts
constructor(message?: string)

AggregateError class ​

ts
class AggregateError extends Error

Bundles multiple errors under one exception. Emitted by Promise.any when every input rejects, and constructable directly to report a batch of failures from parallel work.

errors holds the individual rejection reasons in input order; message is the combined description; name is always "AggregateError".

AggregateError.errors ​

ts
readonly errors: Array<any>

Individual rejection reasons, in input order.

new AggregateError() ​

ts
constructor(errors: Array<any>, message?: string)

Construct from a list of reasons and an optional combined message.


Generated from lang/types/builtin_errors.d.tks in the ThicketScript repository.