スキル一覧に戻る
kensleDev

try-error-handling

by kensleDev

0🍴 0📅 2026年1月16日
GitHubで見るManusで実行

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:

  1. What errors? — Use context7 MCP to check library docs
  2. Handle here or propagate? — Can you recover, or should caller decide?
  3. Who's the audience? — End user (friendly) or developer (detailed)?
  4. 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

OperationWrapperExample
fetch/APItryPromisetryPromise(fetch(url))
DatabasetryPromisetryPromise(db.query(...))
JSON parsetryThrowtryThrow(() => JSON.parse(s))
ValidationtryThrowtryThrow(() => schema.parse(d))
AuthtryPromisetryPromise(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

レビュー

💬

レビュー機能は近日公開予定です