Error Handling Hardening

Developer Toolscursor-vs-windsurffile_or_module_pathcurrent_error_handling

Both editors can scan and fix files systematically. The specific audit checklist prevents vague 'improve error handling' outputs. Cursor shows inline diffs for each fix. Windsurf's Cascade can apply all fixes in sequence.

Prompt
Audit and improve error handling in {{file_or_module_path}}.

Current state: {{current_error_handling}}

Audit checklist:
1. **Unhandled promises**: Find any async operations missing try/catch or .catch()
2. **Silent failures**: Find catch blocks that swallow errors without logging or rethrowing
3. **Generic catches**: Replace catch(e) with specific error type handling where appropriate
4. **User-facing errors**: Ensure errors shown to users are helpful, not stack traces
5. **API boundaries**: Verify all API calls handle network errors, timeouts, and unexpected response shapes
6. **Validation gaps**: Find inputs that aren't validated before use

For each issue, provide:
- Location (file:line or function name)
- Current code
- Fixed code
- Why this matters (what could go wrong in production)

Then add:
- A centralized error handler if the project doesn't have one
- Retry logic for transient failures (network, rate limits) with exponential backoff
- Error boundary components for React UI sections that could crash

Variables to customize

{{file_or_module_path}}{{current_error_handling}}

Why this prompt works

Both editors can scan and fix files systematically. The specific audit checklist prevents vague 'improve error handling' outputs. Cursor shows inline diffs for each fix. Windsurf's Cascade can apply all fixes in sequence.

What you get when you save this prompt

Your workspace unlocks powerful tools to iterate and improve.

AI OPTIMIZE

AI Optimization

One-click improvement with structure analysis and pattern suggestions.

VERSION DIFF

Version History

Track every edit. Compare versions side-by-side with word-level diffs.

ORGANIZE
Development
Code Review
Testing
Marketing

Folders & Tags

Organize your library with nested folders, tags, and drag-and-drop.

MCP
$ npm i -g @promptingbox/mcp
Claude · Cursor · ChatGPT

Use Everywhere

Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.

Your prompts, organized

Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.