Neverthrow Wrap Exceptions

Capture exceptions and promise failures with `neverthrow` instead of hand-written `try/catch` in TypeScript and JavaScript code. Use when wrapping synchronous functions that may throw, promise-returning functions that may throw before returning, existing `PromiseLike` values that may reject, or third-party APIs such as parsers, database clients, HTTP clients, file-system helpers, serializers, and SDK calls. Prefer `Result.fromThrowable` for synchronous throwers, `ResultAsync.fromThrowable` for promise-returning functions that may throw or reject, and `ResultAsync.fromPromise` when you already have a `PromiseLike` value in hand. Only keep `try/catch` when the language construct, cleanup requirement, or framework boundary truly requires it.

code-sherpas 27c58da 5.1 KB Updated

File contents

code-sherpas/agent-skills/tree/main/skills/neverthrow-wrap-exceptions commit 27c58da3ee

Frequently asked questions

npx skillmds@latest add code-sherpas/neverthrow-wrap-exceptions