⚠️ This is pre-release documentation for v3. For stable docs, visit v2.
Skip to content

@tmlmt/cooklang-parser / ReferencedCookwareNotFoundError

Class: ReferencedCookwareNotFoundError ​

Thrown when a referenced cookware (&) cannot be found in the cookware list declared earlier in the recipe.

Extends ​

Constructors ​

Constructor ​

new ReferencedCookwareNotFoundError(cookwareName): ReferencedCookwareNotFoundError

Parameters ​

cookwareName ​

string

Returns ​

ReferencedCookwareNotFoundError

Overrides ​

SingleDiagnosticError.constructor

Properties ​

cause? ​

optional cause?: unknown

Inherited from ​

SingleDiagnosticError.cause


code ​

readonly code: "COOKLANG_E0101" | "COOKLANG_E0102" | "COOKLANG_W0101" | "COOKLANG_E0201" | "COOKLANG_E0202" | "COOKLANG_E0203" | "COOKLANG_E0204" | "COOKLANG_W0201" | "COOKLANG_W0202" | "COOKLANG_E0301" | "COOKLANG_E0302" | "COOKLANG_W0301" | "COOKLANG_I0401" | "COOKLANG_W0401" | "COOKLANG_E9401" | "COOKLANG_E9402" | "COOKLANG_E9501" | "COOKLANG_E9502" | "COOKLANG_E9503" | "COOKLANG_E9504" | "COOKLANG_E9505" | "COOKLANG_E9601" | "COOKLANG_E9602" | "COOKLANG_E9603" | "COOKLANG_E9604" | "COOKLANG_W0601" | "COOKLANG_E9701" | "COOKLANG_W0701" | "COOKLANG_W0702" | "COOKLANG_E0701" | "COOKLANG_E0702"

Shortcut for diagnostic.code.

Inherited from ​

SingleDiagnosticError.code


cookwareName ​

readonly cookwareName: string


diagnostic ​

readonly diagnostic: Diagnostic

The structured diagnostic describing this error.

Inherited from ​

SingleDiagnosticError.diagnostic


diagnostics ​

readonly diagnostics: Diagnostic[]

All diagnostics carried by this error (always at least one).

Inherited from ​

SingleDiagnosticError.diagnostics


message ​

message: string

Inherited from ​

SingleDiagnosticError.message


name ​

name: string

Inherited from ​

SingleDiagnosticError.name


source? ​

readonly optional source?: string

The original text used for parsing, when thrown by a parse() method. Pass to formatDiagnostic for code-frame output.

Inherited from ​

SingleDiagnosticError.source


stack? ​

optional stack?: string

Inherited from ​

SingleDiagnosticError.stack


stackTraceLimit ​

static stackTraceLimit: 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.

Inherited from ​

SingleDiagnosticError.stackTraceLimit

Methods ​

captureStackTrace() ​

static captureStackTrace(targetObject, constructorOpt?): void

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 ​

targetObject ​

object

constructorOpt? ​

Function

Returns ​

void

Inherited from ​

SingleDiagnosticError.captureStackTrace


prepareStackTrace() ​

static prepareStackTrace(err, stackTraces): any

Parameters ​

err ​

Error

stackTraces ​

CallSite[]

Returns ​

any

See ​

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

Inherited from ​

SingleDiagnosticError.prepareStackTrace