بنقرة واحدة
error-handling-guide
Draft a language-agnostic error-handling strategy for a module or service.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Draft a language-agnostic error-handling strategy for a module or service.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Review code changes and report issues by severity with actionable fixes.
Sharpen a fuzzy intention into one measurable objective string that drives the rest of the work.
Convert a Prompt Flow PRS pipeline submission to run a Microsoft Agent Framework workflow.
Build a Model Context Protocol (MCP) server that lets an LLM call into external tools and resources.
Summarize PDF documents into concise bullet-point digests.
Bump a dependency version across a pnpm workspace and update lockfile.
استنادا إلى تصنيف SOC المهني
| slug | error-handling-guide |
| name | Error Handling Guide |
| version | 0.1.0 |
| description | Draft a language-agnostic error-handling strategy for a module or service. |
| category | dev-tools |
| tags | ["errors","exceptions","reliability","logging"] |
| inputs | [{"name":"language","type":"string","required":true,"description":"Primary language or runtime"},{"name":"component","type":"string","required":true,"description":"Service or module boundary"}] |
| output | {"format":"markdown","description":"Strategy covering taxonomy, retries, propagation, and observability."} |
| author | badhope |
| license | MIT |
| created | "2026-06-21T00:00:00.000Z" |
| updated | "2026-06-21T00:00:00.000Z" |
When building a new service, refactoring exception-heavy code, or defining retry/timeout policies.
Name the language/runtime and the component boundary (e.g., payment gateway, ingestion worker).
A strategy document with error taxonomy, retry rules, propagation patterns, and observability hooks.
Draft an error-handling strategy for the given language and component.
Cover:
1. Error taxonomy: user input, transient infra, dependency, bug/programmer error
2. Exception vs result type: when to use each in the named language
3. Retry policy: which errors are retryable, backoff, idempotency keys
4. Propagation: what to expose to callers vs what to mask
5. Logging: required context fields, safe vs unsafe data
6. Metrics: counters and labels for alerting
Output:
## Error Taxonomy
...
## Retry Policy
...
## Caller Contract
...
## Observability
...
Be concrete: reference language idioms (e.g., Result<T,E>, try/catch, checked exceptions).
Input:
language: Python
component: payment webhook processor
Output:
## Error Taxonomy
- UserInputError: 4xx from merchant, do not retry
- TransientError: 5xx / timeout, retry with exponential backoff up to 3 times
- DependencyError: database lock, retry once after jitter
## Retry Policy
Use tenacity with `@retry(stop=stop_after_attempt(3), wait=wait_exponential_jitter(...))`. Mark idempotent endpoints only.
## Caller Contract
Return `{ ok: false, error_code, retryable }`. Never leak stack traces.
These are the bugs that bite every new user. Check them before shipping:
Catching too broadly: Catching Exception or Throwable hides bugs and makes debugging harder.
Retry without idempotency: Retrying operations that aren't idempotent causes duplicate effects (e.g., double charges).
Exposing internal errors to clients: Leaking stack traces, database errors, or internal paths to clients is a security risk.
No timeout on external calls: External service calls without timeouts can hang indefinitely and exhaust resources.
Error codes not documented: Defining error codes but not documenting them means clients guess at meanings.