Skip to main content

typescript-error-handling

このモノレポ(target ESNext / 最新 Node + モダンブラウザ)での失敗の扱い方。 既定は「例外を throw せず自作 `Result<T, E>` を返す」で、TypeScript / TSX で失敗 しうる関数を書くとき——`Result` / `ok` / `err` の使い方、`if (!res.ok)` での narrowing、`E`(失敗理由)に何を入れるか、throw してよい境界の判断をするときに使う。 加えて、例外を扱う場面——独自の Error クラス(`class XxxError extends Error`)を 定義・追加するとき、エラーを投げ直す/エラー連鎖(cause)を書くとき、`this.name` / `Error.captureStackTrace` / `Object.setPrototypeOf` / `toJSON` の扱いを判断するとき、 既存の例外・エラー処理まわりをレビュー・リファクタするときにも使う。Result type, ok/err, extends Error, captureStackTrace, error cause, custom error class といった 話題が出たら参照する。

Jump to install

Source facts

Repository
yamatatsu/project-template-2026
Last source activity
July 4, 2026 at 10:58
Detected SKILL.md language
Japanese
Stars
3
Forks
0

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.