Skip to content

Modules Common Library / Errors

Errors ​

This module defines custom error classes for handling errors that occur in Source bundles. These types are re-exported from js-slang

Enumerations ​

ErrorSeverity ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:9

Enumeration Members ​

ERROR ​
ts
ERROR: "Error";

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:11

WARNING ​
ts
WARNING: "Warning";

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:10


ErrorType ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:3

Enumeration Members ​

IMPORT ​
ts
IMPORT: "Import";

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:4

RUNTIME ​
ts
RUNTIME: "Runtime";

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:5

SYNTAX ​
ts
SYNTAX: "Syntax";

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:6

TYPE ​
ts
TYPE: "Type";

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:7

Classes ​

GeneralRuntimeError ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:45

A concrete instantiation of RuntimeSourceError that can be used when there just aren't any other good Source error classes that can be used

Extends ​

Constructors ​

Constructor ​
ts
new GeneralRuntimeError(
   explanation, 
   node?, 
   elaboration?
): GeneralRuntimeError;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:48

Parameters ​
ParameterType

explanation

string

node?

BaseNode

elaboration?

string

Returns ​

GeneralRuntimeError

Overrides ​

RuntimeSourceError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in

cause?

public

unknown

‐

RuntimeSourceError.cause

node_modules/typescript/lib/lib.es2022.error.d.ts:24

name

public

string

‐

RuntimeSourceError.name

node_modules/typescript/lib/lib.es5.d.ts:1074

node

public

BaseNode | undefined

‐

RuntimeSourceError.node

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24

severity

public

ErrorSeverity

‐

RuntimeSourceError.severity

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38

stack?

public

string

‐

RuntimeSourceError.stack

node_modules/typescript/lib/lib.es5.d.ts:1076

stackTraceLimit

static

number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

RuntimeSourceError.stackTraceLimit

node_modules/@types/node/globals.d.ts:68

type

public

ErrorType

‐

RuntimeSourceError.type

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37

Accessors ​

location ​
Get Signature ​
ts
get location(): SourceLocation;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26

Returns ​

SourceLocation

Inherited from ​

RuntimeSourceError.location

message ​
Get Signature ​
ts
get message(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31

Returns ​

string

Inherited from ​

RuntimeSourceError.message

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType

targetObject

object

constructorOpt?

Function

Returns ​

void

Inherited from ​

RuntimeSourceError.captureStackTrace

elaborate() ​
ts
elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:50

Returns ​

string

Overrides ​

RuntimeSourceError.elaborate

explain() ​
ts
explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:49

Returns ​

string

Overrides ​

RuntimeSourceError.explain

isError() ​
ts
static isError(error): error is Error;

Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:21

Indicates whether the argument provided is a built-in Error instance or not.

Parameters ​
ParameterType

error

unknown

Returns ​

error is Error

Inherited from ​

RuntimeSourceError.isError

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType

err

Error

stackTraces

CallSite[]

Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

RuntimeSourceError.prepareStackTrace


InternalRuntimeError ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:56

A subclass of RuntimeSourceError intended for use when an unexpected runtime error occurs due to an internal error rather than any error caused by the code being evaluated.

Extends ​

Type Parameters ​

Type ParameterDefault type

T extends es.BaseNode

Node

Constructors ​

Constructor ​
ts
new InternalRuntimeError<T>(
   explanation, 
   node?, 
   elaboration?
): InternalRuntimeError<T>;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:59

Parameters ​
ParameterType

explanation

string

node?

T

elaboration?

string

Returns ​

InternalRuntimeError<T>

Overrides ​

RuntimeSourceError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in

cause?

public

unknown

‐

RuntimeSourceError.cause

node_modules/typescript/lib/lib.es2022.error.d.ts:24

name

public

string

‐

RuntimeSourceError.name

node_modules/typescript/lib/lib.es5.d.ts:1074

node

public

T | undefined

‐

RuntimeSourceError.node

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24

severity

public

ErrorSeverity

‐

RuntimeSourceError.severity

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38

stack?

public

string

‐

RuntimeSourceError.stack

node_modules/typescript/lib/lib.es5.d.ts:1076

stackTraceLimit

static

number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

RuntimeSourceError.stackTraceLimit

node_modules/@types/node/globals.d.ts:68

type

public

ErrorType

‐

RuntimeSourceError.type

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37

Accessors ​

location ​
Get Signature ​
ts
get location(): SourceLocation;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26

Returns ​

SourceLocation

Inherited from ​

RuntimeSourceError.location

message ​
Get Signature ​
ts
get message(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31

Returns ​

string

Inherited from ​

RuntimeSourceError.message

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType

targetObject

object

constructorOpt?

Function

Returns ​

void

Inherited from ​

RuntimeSourceError.captureStackTrace

elaborate() ​
ts
elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:61

Returns ​

string

Overrides ​

RuntimeSourceError.elaborate

explain() ​
ts
explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:60

Returns ​

string

Overrides ​

RuntimeSourceError.explain

isError() ​
ts
static isError(error): error is Error;

Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:21

Indicates whether the argument provided is a built-in Error instance or not.

Parameters ​
ParameterType

error

unknown

Returns ​

error is Error

Inherited from ​

RuntimeSourceError.isError

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType

err

Error

stackTraces

CallSite[]

Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

RuntimeSourceError.prepareStackTrace


InvalidCallbackError ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:64

A subclass of the InvalidParameterTypeError that is thrown when a function receives a callback parameter that is not a function or does not have the expected number of parameters.

Example ​

function call_callback(callback: (x: number, y: number) => number) {
  if (!isFunctionOfLength(callback, 2)) {
    throw new InvalidCallbackError(2, callback, call_callback.name, 'callback');
  }
}

Extends ​

Constructors ​

Constructor ​
ts
new InvalidCallbackError(
   expected, 
   actualValue, 
   func_name, 
   param_name?, 
   node?
): InvalidCallbackError;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:65

Parameters ​
ParameterTypeDescription

expected

string | number

Either the expected number of parameters of the callback function, or a string describing the expected callback type.

actualValue

unknown

‐

func_name

string

‐

param_name?

string

‐

node?

BaseNode

‐

Returns ​

InvalidCallbackError

Overrides ​

InvalidParameterTypeError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in

actualValue

readonly

unknown

The actual value that was received.

InvalidParameterTypeError.actualValue

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:23

cause?

public

unknown

‐

InvalidParameterTypeError.cause

node_modules/typescript/lib/lib.es2022.error.d.ts:24

expectedType

readonly

string

String representation of the expected type. Examples include "number", "string", or "Point".

InvalidParameterTypeError.expectedType

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:19

func_name

readonly

string

The name of the function that received the invalid parameter.

InvalidParameterTypeError.func_name

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:27

name

public

string

‐

InvalidParameterTypeError.name

node_modules/typescript/lib/lib.es5.d.ts:1074

node

public

BaseNode | undefined

‐

InvalidParameterTypeError.node

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24

param_name?

readonly

string

The name of the parameter that received the invalid value, if available.

InvalidNumberParameterError.param_name

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:31

severity

public

ErrorSeverity

‐

RuntimeSourceError.severity

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38

stack?

public

string

‐

InvalidParameterTypeError.stack

node_modules/typescript/lib/lib.es5.d.ts:1076

stackTraceLimit

static

number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

InvalidParameterTypeError.stackTraceLimit

node_modules/@types/node/globals.d.ts:68

type

public

ErrorType

‐

RuntimeSourceError.type

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37

Accessors ​

location ​
Get Signature ​
ts
get location(): SourceLocation;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26

Returns ​

SourceLocation

Inherited from ​

InvalidParameterTypeError.location

message ​
Get Signature ​
ts
get message(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31

Returns ​

string

Inherited from ​

InvalidParameterTypeError.message

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType

targetObject

object

constructorOpt?

Function

Returns ​

void

Inherited from ​

InvalidParameterTypeError.captureStackTrace

elaborate() ​
ts
elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39

Returns ​

string

Inherited from ​

InvalidParameterTypeError.elaborate

explain() ​
ts
explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:49

Returns ​

string

Inherited from ​

InvalidParameterTypeError.explain

isError() ​
ts
static isError(error): error is Error;

Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:21

Indicates whether the argument provided is a built-in Error instance or not.

Parameters ​
ParameterType

error

unknown

Returns ​

error is Error

Inherited from ​

InvalidParameterTypeError.isError

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType

err

Error

stackTraces

CallSite[]

Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

InvalidParameterTypeError.prepareStackTrace


InvalidNumberParameterError ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:89

Subclass of InvalidParameterTypeError intended for use with numeric values

Extends ​

Constructors ​

Constructor ​
ts
new InvalidNumberParameterError(
   value, 
   options, 
   func_name, 
   param_name?, 
   node?
): InvalidNumberParameterError;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:90

Parameters ​
ParameterType

value

unknown

options

| string | InvalidNumberParameterErrorOptions

func_name

string

param_name?

string

node?

BaseNode

Returns ​

InvalidNumberParameterError

Overrides ​

InvalidParameterTypeError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in

actualValue

readonly

unknown

The actual value that was received.

InvalidParameterTypeError.actualValue

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:23

cause?

public

unknown

‐

InvalidParameterTypeError.cause

node_modules/typescript/lib/lib.es2022.error.d.ts:24

expectedType

readonly

string

String representation of the expected type. Examples include "number", "string", or "Point".

InvalidParameterTypeError.expectedType

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:19

func_name

readonly

string

The name of the function that received the invalid parameter.

InvalidParameterTypeError.func_name

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:27

name

public

string

‐

InvalidParameterTypeError.name

node_modules/typescript/lib/lib.es5.d.ts:1074

node

public

BaseNode | undefined

‐

InvalidParameterTypeError.node

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24

param_name?

readonly

string

The name of the parameter that received the invalid value, if available.

InvalidParameterTypeError.param_name

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:31

severity

public

ErrorSeverity

‐

InvalidParameterTypeError.severity

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38

stack?

public

string

‐

InvalidParameterTypeError.stack

node_modules/typescript/lib/lib.es5.d.ts:1076

stackTraceLimit

static

number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

InvalidParameterTypeError.stackTraceLimit

node_modules/@types/node/globals.d.ts:68

type

public

ErrorType

‐

InvalidParameterTypeError.type

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37

Accessors ​

location ​
Get Signature ​
ts
get location(): SourceLocation;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26

Returns ​

SourceLocation

Inherited from ​

InvalidParameterTypeError.location

message ​
Get Signature ​
ts
get message(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31

Returns ​

string

Inherited from ​

InvalidParameterTypeError.message

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType

targetObject

object

constructorOpt?

Function

Returns ​

void

Inherited from ​

InvalidParameterTypeError.captureStackTrace

elaborate() ​
ts
elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39

Returns ​

string

Inherited from ​

InvalidParameterTypeError.elaborate

explain() ​
ts
explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:49

Returns ​

string

Inherited from ​

InvalidParameterTypeError.explain

isError() ​
ts
static isError(error): error is Error;

Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:21

Indicates whether the argument provided is a built-in Error instance or not.

Parameters ​
ParameterType

error

unknown

Returns ​

error is Error

Inherited from ​

InvalidParameterTypeError.isError

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType

err

Error

stackTraces

CallSite[]

Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

InvalidParameterTypeError.prepareStackTrace


InvalidParameterTypeError ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:15

A specific RuntimeSourceError that is thrown when a function receives a parameter of the wrong type.

Example ​

function play_sound(sound: unknown): asserts sound is Sound {
  if (!is_sound(sound)) {
    throw new InvalidParameterTypeError('Sound', sound, play_sound.name, 'sound');
  }
}

Extends ​

Extended by ​

Constructors ​

Constructor ​
ts
new InvalidParameterTypeError(
   expectedType, 
   actualValue, 
   func_name, 
   param_name?, 
   node?
): InvalidParameterTypeError;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:32

Parameters ​
ParameterTypeDescription

expectedType

string

String representation of the expected type. Examples include "number", "string", or "Point".

actualValue

unknown

The actual value that was received.

func_name

string

The name of the function that received the invalid parameter.

param_name?

string

The name of the parameter that received the invalid value, if available.

node?

BaseNode

‐

Returns ​

InvalidParameterTypeError

Overrides ​

RuntimeSourceError.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in

actualValue

readonly

unknown

The actual value that was received.

‐

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:23

cause?

public

unknown

‐

RuntimeSourceError.cause

node_modules/typescript/lib/lib.es2022.error.d.ts:24

expectedType

readonly

string

String representation of the expected type. Examples include "number", "string", or "Point".

‐

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:19

func_name

readonly

string

The name of the function that received the invalid parameter.

‐

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:27

name

public

string

‐

RuntimeSourceError.name

node_modules/typescript/lib/lib.es5.d.ts:1074

node

public

BaseNode | undefined

‐

RuntimeSourceError.node

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24

param_name?

readonly

string

The name of the parameter that received the invalid value, if available.

‐

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:31

severity

public

ErrorSeverity

‐

RuntimeSourceError.severity

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38

stack?

public

string

‐

RuntimeSourceError.stack

node_modules/typescript/lib/lib.es5.d.ts:1076

stackTraceLimit

static

number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

RuntimeSourceError.stackTraceLimit

node_modules/@types/node/globals.d.ts:68

type

public

ErrorType

‐

RuntimeSourceError.type

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37

Accessors ​

location ​
Get Signature ​
ts
get location(): SourceLocation;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26

Returns ​

SourceLocation

Inherited from ​

RuntimeSourceError.location

message ​
Get Signature ​
ts
get message(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31

Returns ​

string

Inherited from ​

RuntimeSourceError.message

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType

targetObject

object

constructorOpt?

Function

Returns ​

void

Inherited from ​

RuntimeSourceError.captureStackTrace

elaborate() ​
ts
elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39

Returns ​

string

Inherited from ​

RuntimeSourceError.elaborate

explain() ​
ts
explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:49

Returns ​

string

Overrides ​

RuntimeSourceError.explain

isError() ​
ts
static isError(error): error is Error;

Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:21

Indicates whether the argument provided is a built-in Error instance or not.

Parameters ​
ParameterType

error

unknown

Returns ​

error is Error

Inherited from ​

RuntimeSourceError.isError

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType

err

Error

stackTraces

CallSite[]

Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

RuntimeSourceError.prepareStackTrace


abstract RuntimeSourceError ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:36

Abstract Source Error class for Runtime errors

Extends ​

Extended by ​

Type Parameters ​

Type ParameterDefault type

T extends es.BaseNode | undefined

es.BaseNode | undefined

Constructors ​

Constructor ​
ts
new RuntimeSourceError<T>(node): RuntimeSourceError<T>;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:25

Parameters ​
ParameterType

node

T

Returns ​

RuntimeSourceError<T>

Inherited from ​

SourceErrorWithNode.constructor

Properties ​

PropertyModifierTypeDescriptionOverridesInherited fromDefined in

cause?

public

unknown

‐

‐

SourceErrorWithNode.cause

node_modules/typescript/lib/lib.es2022.error.d.ts:24

name

public

string

‐

‐

SourceErrorWithNode.name

node_modules/typescript/lib/lib.es5.d.ts:1074

node

public

T

‐

‐

SourceErrorWithNode.node

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24

severity

public

ErrorSeverity

‐

SourceErrorWithNode.severity

‐

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38

stack?

public

string

‐

‐

SourceErrorWithNode.stack

node_modules/typescript/lib/lib.es5.d.ts:1076

stackTraceLimit

static

number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

‐

SourceErrorWithNode.stackTraceLimit

node_modules/@types/node/globals.d.ts:68

type

public

ErrorType

‐

SourceErrorWithNode.type

‐

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37

Accessors ​

location ​
Get Signature ​
ts
get location(): SourceLocation;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26

Returns ​

SourceLocation

Inherited from ​

SourceErrorWithNode.location

message ​
Get Signature ​
ts
get message(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31

Returns ​

string

Inherited from ​

SourceErrorWithNode.message

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType

targetObject

object

constructorOpt?

Function

Returns ​

void

Inherited from ​

SourceErrorWithNode.captureStackTrace

elaborate() ​
ts
elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39

Returns ​

string

Overrides ​

SourceErrorWithNode.elaborate

explain() ​
ts
abstract explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:29

Returns ​

string

Inherited from ​

SourceErrorWithNode.explain

isError() ​
ts
static isError(error): error is Error;

Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:21

Indicates whether the argument provided is a built-in Error instance or not.

Parameters ​
ParameterType

error

unknown

Returns ​

error is Error

Inherited from ​

SourceErrorWithNode.isError

prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType

err

Error

stackTraces

CallSite[]

Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​

SourceErrorWithNode.prepareStackTrace


abstract SourceErrorWithNode ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:23

Abstract Source Error class that automatically handles its location property

Extends ​

  • Error

Extended by ​

Type Parameters ​

Type ParameterDefault type

T extends es.BaseNode | undefined

es.BaseNode | undefined

Implements ​

Constructors ​

Constructor ​
ts
new SourceErrorWithNode<T>(node): SourceErrorWithNode<T>;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:25

Parameters ​
ParameterType

node

T

Returns ​

SourceErrorWithNode<T>

Overrides ​
ts
Error.constructor

Properties ​

PropertyModifierTypeDescriptionInherited fromDefined in

cause?

public

unknown

‐

ts
Error.cause

node_modules/typescript/lib/lib.es2022.error.d.ts:24

name

public

string

‐

ts
Error.name

node_modules/typescript/lib/lib.es5.d.ts:1074

node

public

T

‐

‐

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24

severity

abstract

ErrorSeverity

‐

‐

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:28

stack?

public

string

‐

ts
Error.stack

node_modules/typescript/lib/lib.es5.d.ts:1076

stackTraceLimit

static

number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

ts
Error.stackTraceLimit

node_modules/@types/node/globals.d.ts:68

type

abstract

ErrorType

‐

‐

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:27

Accessors ​

location ​
Get Signature ​
ts
get location(): SourceLocation;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26

Returns ​

SourceLocation

Implementation of ​

SourceError.location

message ​
Get Signature ​
ts
get message(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31

Returns ​

string

Overrides ​
ts
Error.message

Methods ​

captureStackTrace() ​
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/@types/node/globals.d.ts:52

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters ​
ParameterType

targetObject

object

constructorOpt?

Function

Returns ​

void

Inherited from ​
ts
Error.captureStackTrace
elaborate() ​
ts
abstract elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:30

Returns ​

string

Implementation of ​

SourceError.elaborate

explain() ​
ts
abstract explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:29

Returns ​

string

Implementation of ​

SourceError.explain

isError() ​
ts
static isError(error): error is Error;

Defined in: node_modules/typescript/lib/lib.esnext.error.d.ts:21

Indicates whether the argument provided is a built-in Error instance or not.

Parameters ​
ParameterType

error

unknown

Returns ​

error is Error

Inherited from ​
ts
Error.isError
prepareStackTrace() ​
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/@types/node/globals.d.ts:56

Parameters ​
ParameterType

err

Error

stackTraces

CallSite[]

Returns ​

any

See ​

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from ​
ts
Error.prepareStackTrace

Interfaces ​

InvalidNumberParameterErrorOptions ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:71

Properties ​

PropertyTypeDescriptionDefined in

integer?

boolean

true by default. Set to false to allow non integer values

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:83

max?

number

Maximum allowable value (inclusive). Set to undefined to not perform a maximum check.

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:75

min?

number

Minimum allowable value (inclusive). Set to undefined to not perform a minimum check.

lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:79


SourceError ​

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:13

Properties ​

PropertyModifierTypeDefined in

location

public

SourceLocation

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:16

severity

readonly

ErrorSeverity

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:15

type

readonly

ErrorType

lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:14

Methods ​

elaborate() ​
ts
elaborate(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:18

Returns ​

string

explain() ​
ts
explain(): string;

Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:17

Returns ​

string