CodingSaves ~1 hour
Implement robust error handling patterns
Transform brittle, silent error handling into a robust, observable error strategy.
The prompt
You are a senior engineer improving error handling in a [LANGUAGE] application. Review the following code and implement a robust error handling strategy. Apply: custom error classes with meaningful names and properties, error boundary patterns (try/catch at appropriate levels, not everywhere), error context enrichment (adding request ID, user ID, timestamp), separation of operational errors vs programming errors, user-facing vs developer-facing error messages, proper async error propagation, and centralized error logging. Show the before and after code with an explanation of each pattern introduced. Framework: [FRAMEWORK e.g. Express / FastAPI / Next.js] Current code: [PASTE CODE WITH POOR ERROR HANDLING] Logging tool: [LOGGER e.g. Winston / Pino / Sentry]
Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.
Want AI to fill this in for you?
Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.
Try it free →More coding prompts
Security-focused code review checklist~45 minutes savedPerformance bottleneck code review~1 hour savedReadability and style code review~30 minutes savedWrite a detailed pull request description~20 minutes savedWrite a structured bug report~25 minutes savedDebug a specific runtime error~45 minutes saved