Reference · Rules, generation and deductions
GenerationErrorclass
A bounded generator must say it failed, never quietly return a guessing board.
Import it
import { GenerationError } from "@johnmorrisdotca/jirai";
Definition
class GenerationError
new GenerationError(code: "settings" | "opening" | "exhausted", message: string): GenerationError
Parameters
| Name | Type | Description |
|---|---|---|
code | "opening" | "settings" | "exhausted" | settings for invalid input, opening for an impossible safe opening, or exhausted for a spent generation budget. |
message | string | The readable reason for generation failure. |
Members
| Name | Type | Description |
|---|---|---|
code | "opening" | "settings" | "exhausted" | |
name | string | |
message | string | |
stack (optional) | string | undefined | |
cause (optional) | unknown |
Examples
import { GenerationError } from "@johnmorrisdotca/jirai";
const error=new GenerationError("exhausted","No proved field within this budget");
console.log(error.code,error.message);exhausted No proved field within this budgetWhat it prints (run when this page was built)