Skip to main content
Version: v0.0.2

Class: LoopSpecDefinitionError

Thrown by defineLoopSpec when the supplied spec is structurally invalid. Carries the offending path so a consumer fixing a typo doesn't have to hunt: e.g. "segments[3].id" or "children[0].trigger".

Example

import { defineLoopSpec, LoopSpecDefinitionError } from "@cosyte/x12";
try {
defineLoopSpec({
id: "2300",
trigger: "clm",
segments: [{ id: "clm", usage: "required", max: 1 }],
});
} catch (err) {
if (err instanceof LoopSpecDefinitionError) {
// err.path === "trigger"
}
}

Extends

  • Error

Constructors

Constructor

new LoopSpecDefinitionError(path, message): LoopSpecDefinitionError

Internal

Construct a new LoopSpecDefinitionError with the offending path.

Parameters

path

string

message

string

Returns

LoopSpecDefinitionError

Overrides

Error.constructor

Properties

path

readonly path: string