Reference · Build a mesh and a drawing
FitErrorclass
Raised by build when a description does not fit. Its report says why, in the same words check gives.
Import it
import { FitError } from "@johnmorrisdotca/uchusen-rockets/build";
Definition
class FitError
new FitError(report: FitReport): FitError
Parameters
| Name | Type | Description |
|---|---|---|
report | FitReport | The report of the fit check that failed. |
Members
| Name | Type | Description |
|---|---|---|
report | FitReport | |
name | string | |
message | string | |
stack (optional) | string | undefined | |
cause (optional) | unknown |
Examples
import { build, FitError } from "@johnmorrisdotca/uchusen-rockets/build";
try {
build({ rocket: "starship", variant: "v3", parts: { booster: "starship-v3-ship" } });
} catch (error) {
if (error instanceof FitError) console.log(error.report.issues[0]?.message);
}Ship, Block 3 (V3) is a ship; this slot takes a booster.What it prints (run when this page was built)