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
ERROR: "Error";Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:11
WARNING
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
IMPORT: "Import";Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:4
RUNTIME
RUNTIME: "Runtime";Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:5
SYNTAX
SYNTAX: "Syntax";Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:6
TYPE
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
RuntimeSourceError<es.BaseNode|undefined>
Constructors
Constructor
new GeneralRuntimeError(
explanation,
node?,
elaboration?): GeneralRuntimeError;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:48
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Overrides
RuntimeSourceError.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
|
| ‐ | node_modules/typescript/lib/lib.es2022.error.d.ts:24 | ||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1074 | ||
|
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38 | |||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1076 | ||
|
| The The default value is If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | node_modules/@types/node/globals.d.ts:68 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37 |
Accessors
location
Get Signature
get location(): SourceLocation;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26
Returns
SourceLocation
Inherited from
message
Get Signature
get message(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31
Returns
string
Inherited from
Methods
captureStackTrace()
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.
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:
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
| Parameter | Type |
|---|---|
|
|
|
|
Returns
void
Inherited from
RuntimeSourceError.captureStackTrace
elaborate()
elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:50
Returns
string
Overrides
explain()
explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:49
Returns
string
Overrides
isError()
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
| Parameter | Type |
|---|---|
|
|
Returns
error is Error
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
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
RuntimeSourceError<T|undefined>
Type Parameters
| Type Parameter | Default type |
|---|---|
|
|
Constructors
Constructor
new InternalRuntimeError<T>(
explanation,
node?,
elaboration?): InternalRuntimeError<T>;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:59
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Overrides
RuntimeSourceError.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
|
| ‐ | node_modules/typescript/lib/lib.es2022.error.d.ts:24 | ||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1074 | ||
|
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38 | |||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1076 | ||
|
| The The default value is If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | node_modules/@types/node/globals.d.ts:68 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37 |
Accessors
location
Get Signature
get location(): SourceLocation;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26
Returns
SourceLocation
Inherited from
message
Get Signature
get message(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31
Returns
string
Inherited from
Methods
captureStackTrace()
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.
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:
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
| Parameter | Type |
|---|---|
|
|
|
|
Returns
void
Inherited from
RuntimeSourceError.captureStackTrace
elaborate()
elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:61
Returns
string
Overrides
explain()
explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:60
Returns
string
Overrides
isError()
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
| Parameter | Type |
|---|---|
|
|
Returns
error is Error
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
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
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
| Parameter | Type | Description |
|---|---|---|
|
| Either the expected number of parameters of the callback function, or a string describing the expected callback type. |
|
| ‐ |
|
| ‐ |
|
| ‐ |
|
| ‐ |
Returns
Overrides
InvalidParameterTypeError.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
|
| The actual value that was received. | lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:23 | ||
|
| ‐ | node_modules/typescript/lib/lib.es2022.error.d.ts:24 | ||
|
| 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 | ||
|
| The name of the function that received the invalid parameter. | lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:27 | ||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1074 | ||
|
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24 | ||
|
| 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 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38 | |||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1076 | ||
|
| The The default value is If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | node_modules/@types/node/globals.d.ts:68 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37 |
Accessors
location
Get Signature
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
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()
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.
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:
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
| Parameter | Type |
|---|---|
|
|
|
|
Returns
void
Inherited from
InvalidParameterTypeError.captureStackTrace
elaborate()
elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39
Returns
string
Inherited from
InvalidParameterTypeError.elaborate
explain()
explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:49
Returns
string
Inherited from
InvalidParameterTypeError.explain
isError()
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
| Parameter | Type |
|---|---|
|
|
Returns
error is Error
Inherited from
InvalidParameterTypeError.isError
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
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
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
| Parameter | Type |
|---|---|
|
|
| | |
|
|
|
|
|
|
Returns
Overrides
InvalidParameterTypeError.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
|
| The actual value that was received. | lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:23 | ||
|
| ‐ | node_modules/typescript/lib/lib.es2022.error.d.ts:24 | ||
|
| 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 | ||
|
| The name of the function that received the invalid parameter. | lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:27 | ||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1074 | ||
|
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24 | ||
|
| 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 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38 | |||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1076 | ||
|
| The The default value is If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | node_modules/@types/node/globals.d.ts:68 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37 |
Accessors
location
Get Signature
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
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()
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.
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:
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
| Parameter | Type |
|---|---|
|
|
|
|
Returns
void
Inherited from
InvalidParameterTypeError.captureStackTrace
elaborate()
elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39
Returns
string
Inherited from
InvalidParameterTypeError.elaborate
explain()
explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:49
Returns
string
Inherited from
InvalidParameterTypeError.explain
isError()
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
| Parameter | Type |
|---|---|
|
|
Returns
error is Error
Inherited from
InvalidParameterTypeError.isError
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
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
RuntimeSourceError<BaseNode|undefined>
Extended by
Constructors
Constructor
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
| Parameter | Type | Description |
|---|---|---|
|
| String representation of the expected type. Examples include "number", "string", or "Point". |
|
| The actual value that was received. |
|
| The name of the function that received the invalid parameter. |
|
| The name of the parameter that received the invalid value, if available. |
|
| ‐ |
Returns
Overrides
RuntimeSourceError.constructor
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
|
| The actual value that was received. | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:23 | |
|
| ‐ | node_modules/typescript/lib/lib.es2022.error.d.ts:24 | ||
|
| 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 | |
|
| The name of the function that received the invalid parameter. | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:27 | |
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1074 | ||
|
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24 | ||
|
| 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 | |
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38 | |||
|
| ‐ | node_modules/typescript/lib/lib.es5.d.ts:1076 | ||
|
| The The default value is If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | node_modules/@types/node/globals.d.ts:68 | ||
| ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37 |
Accessors
location
Get Signature
get location(): SourceLocation;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26
Returns
SourceLocation
Inherited from
message
Get Signature
get message(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31
Returns
string
Inherited from
Methods
captureStackTrace()
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.
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:
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
| Parameter | Type |
|---|---|
|
|
|
|
Returns
void
Inherited from
RuntimeSourceError.captureStackTrace
elaborate()
elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39
Returns
string
Inherited from
explain()
explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:49
Returns
string
Overrides
isError()
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
| Parameter | Type |
|---|---|
|
|
Returns
error is Error
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
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 Parameter | Default type |
|---|---|
|
|
Constructors
Constructor
new RuntimeSourceError<T>(node): RuntimeSourceError<T>;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:25
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Inherited from
SourceErrorWithNode.constructor
Properties
| Property | Modifier | Type | Description | Overrides | Inherited from | Defined in |
|---|---|---|---|---|---|---|
|
| ‐ | ‐ | node_modules/typescript/lib/lib.es2022.error.d.ts:24 | ||
|
| ‐ | ‐ | node_modules/typescript/lib/lib.es5.d.ts:1074 | ||
|
| ‐ | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24 | ||
| ‐ | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:38 | |||
|
| ‐ | ‐ | node_modules/typescript/lib/lib.es5.d.ts:1076 | ||
|
| The The default value is If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | ‐ | node_modules/@types/node/globals.d.ts:68 | ||
| ‐ | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:37 |
Accessors
location
Get Signature
get location(): SourceLocation;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26
Returns
SourceLocation
Inherited from
message
Get Signature
get message(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31
Returns
string
Inherited from
Methods
captureStackTrace()
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.
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:
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
| Parameter | Type |
|---|---|
|
|
|
|
Returns
void
Inherited from
SourceErrorWithNode.captureStackTrace
elaborate()
elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:39
Returns
string
Overrides
explain()
abstract explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:29
Returns
string
Inherited from
isError()
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
| Parameter | Type |
|---|---|
|
|
Returns
error is Error
Inherited from
prepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
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 Parameter | Default type |
|---|---|
|
|
Implements
Constructors
Constructor
new SourceErrorWithNode<T>(node): SourceErrorWithNode<T>;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:25
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Overrides
Error.constructorProperties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
|
| ‐ | ts | node_modules/typescript/lib/lib.es2022.error.d.ts:24 | |
|
| ‐ | ts | node_modules/typescript/lib/lib.es5.d.ts:1074 | |
|
| ‐ | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:24 | |
| ‐ | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:28 | ||
|
| ‐ | ts | node_modules/typescript/lib/lib.es5.d.ts:1076 | |
|
| The The default value is If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | ts | node_modules/@types/node/globals.d.ts:68 | |
| ‐ | ‐ | lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:27 |
Accessors
location
Get Signature
get location(): SourceLocation;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:26
Returns
SourceLocation
Implementation of
message
Get Signature
get message(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:31
Returns
string
Overrides
Error.messageMethods
captureStackTrace()
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.
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:
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
| Parameter | Type |
|---|---|
|
|
|
|
Returns
void
Inherited from
Error.captureStackTraceelaborate()
abstract elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:30
Returns
string
Implementation of
explain()
abstract explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:29
Returns
string
Implementation of
isError()
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
| Parameter | Type |
|---|---|
|
|
Returns
error is Error
Inherited from
Error.isErrorprepareStackTrace()
static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:56
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTraceInterfaces
InvalidNumberParameterErrorOptions
Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:71
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
|
| lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:83 | |
| Maximum allowable value (inclusive). Set to | lib/modules-lib/node_modules/js-slang/dist/errors/rttcErrors.d.ts:75 | |
| Minimum allowable value (inclusive). Set to | 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
| Property | Modifier | Type | Defined in |
|---|---|---|---|
|
| lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:16 | |
| lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:15 | ||
| lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:14 |
Methods
elaborate()
elaborate(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:18
Returns
string
explain()
explain(): string;Defined in: lib/modules-lib/node_modules/js-slang/dist/errors/base.d.ts:17
Returns
string