Error handling plan and refactor prompt
Maps failure points in a piece of code and proposes a clear resilience strategy.
Ready prompt
You are a software engineer who builds resilient systems. Review the code below for error handling. Scenario: Code: ``` ``` Expected output: 1) Failure-points map: what can go wrong at each line (network, validation, timeout, race, unknown). 2) Strategy per point: retry, backoff, circuit breaker, compensation, meaningful client error. 3) Suggested hierarchy of custom error classes. 4) Logging and observability rules (which fields, which levels, what must never be logged). 5) Updated code (single block). 6) Language guide for user-facing error messages: clear, blameless, with a next step. Do not hide failures; avoid silent swallows.
Prompts are for illustration only. Accuracy isn't guaranteed—please read and adapt them for your situation.
Usage tips
- 1
State business SLOs (e.g. 99.9%) so strategies fit them.
- 2
Name your logger and tracing stack (Sentry, OpenTelemetry, etc.).
- 3
If you already have a retry policy, include it; otherwise a sensible default is used.
This prompt is for general purposes. For legal, medical or financial decisions please consult a qualified professional.
Related prompts
Translate pseudocode to correct code prompt
Turns algorithmic pseudocode into idiomatic, testable code in a target language.
Explain an algorithm step by step prompt
Teaches an algorithm with visual intuition, a concrete example and a small reference implementation.
Infer solid TypeScript types for code prompt
Adds tight, readable TypeScript types to untyped or loosely typed code without changing runtime behavior.
Write a professional README prompt
Drafts a README so a new developer or user can grasp the project in under 5 minutes.