← スキル一覧に戻る

try-error-handling
by kensleDev
⭐ 0🍴 0📅 2026年1月16日
SKILL.md
name: try-error-handling description: Error handling with @julian-i/try-error. Wrap throwable code with tryPromise (async) or tryThrow (sync). Forces reflection on error types, handling location, audience, and recovery.
Error Handling with @julian-i/try-error
Wrap all throwable operations. Before handling, ask:
- What errors? — Use context7 MCP to check library docs
- Handle here or propagate? — Can you recover, or should caller decide?
- Who's the audience? — End user (friendly) or developer (detailed)?
- Recovery strategy? — Retry, fallback, degrade, or fail fast?
Usage
import { tryPromise, tryThrow } from '@julian-i/try-error';
// Async: fetch, db, auth, file I/O
const [data, error] = await tryPromise(fetch('/api/users'));
// Sync: JSON.parse, validation, transforms
const [parsed, error] = tryThrow(() => JSON.parse(raw));
if (error) {
// Handle based on error type and audience
}
Quick Reference
| Operation | Wrapper | Example |
|---|---|---|
| fetch/API | tryPromise | tryPromise(fetch(url)) |
| Database | tryPromise | tryPromise(db.query(...)) |
| JSON parse | tryThrow | tryThrow(() => JSON.parse(s)) |
| Validation | tryThrow | tryThrow(() => schema.parse(d)) |
| Auth | tryPromise | tryPromise(auth.signIn(...)) |
References
- Error types by library:
references/error-sources.md— Prisma, Drizzle, better-auth, Zod, fetch, Stripe - SvelteKit patterns:
references/sveltekit-patterns.md— actions, load, endpoints, hooks - Next.js patterns:
references/nextjs-patterns.md— server actions, route handlers, middleware - TypeScript patterns:
references/typescript-patterns.md— services, utilities, testing
スコア
総合スコア
40/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です