FitErrorクラス
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Raised by build when a description does not fit. Its report says why, in the same words check gives.
インポート
import { FitError } from "@johnmorrisdotca/uchusen-rockets/build";
定義
class FitError
new FitError(report: FitReport): FitError
引数
| 名前 | 型 | 説明 |
|---|---|---|
report | FitReport | The report of the fit check that failed. |
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
report | FitReport | |
name | string | |
message | string | |
stack (省略可) | string | undefined | |
cause (省略可) | unknown |
例
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.出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。