Error Handling Pattern

Design robust error handling for an application component

🧪 Tested by a human Advanced 👤 Developer 👤 Tech Lead
Design error handling for [COMPONENT — API endpoint / background job / file processor / user form] in [LANGUAGE]. Include: (1) Input validation, (2) Try-catch structure, (3) Specific exception types to handle, (4) Logging strategy, (5) User-friendly error messages, (6) Retry logic for transient failures, (7) Graceful degradation. Show complete code.

Works on

🟢 ChatGPT ⭐ Claude (Best)

Copy & Open in

Prompt is copied to your clipboard when you click

Tips for Best Results

  • Never expose stack traces to end users
  • Log enough detail for debugging but no sensitive data
  • Use exponential backoff for retry logic
💬