Stop manually adding error boundaries. Use these prompts with Cursor (.cursorrules), Replit Agent, or Claude to automate your BugMail integration.
1. The "Global Safety Net" (For Cursor/Replit)
Goal: Wrap every API route with BugMail error reporting.
"Review all files in
/app/api(or/pages/api). For every route, ensure there is a try/catch block. If an error is caught, use@bugmail-js/nexttocaptureServerError(error). Make sure to include relevant context like the route path and request method. If a route doesn't have a try/catch, add one now."
2. The "UI Defense" (For React/Next.js)
Goal: Catch frontend crashes in interactive components.
"Add a global React Error Boundary to my main layout using
@bugmail-js/next. Additionally, scan my/componentsfolder. For any component that handles user input or complex state, add a localizedtry/catchthat reports to BugMail without breaking the UI flow."
3. The "Silent 500" Hunter (For Vercel users)
Goal: Catch unhandled server crashes that normally show a blank screen.
"Create an
app/error.tsxfile that usescreateAppRouterErrorHandlerfrom BugMail. This file should report the crash and show a user-friendly 'Our team has been notified' message instead of the generic Vercel 500 page."
4. The "Prompt Secret" for your .cursorrules
Add this to your .cursorrules to ensure AI always writes safe code:
- ALWAYS include BugMail error reporting in any new API route logic.
- NEVER leave a catch block empty.
- ALWAYS use `captureServerError` for backend and `captureError` for frontend logic.
- Use context tags like { feature: "[feature name]" } to make errors easier to find in the inbox.
Ship fast, but don't ship blind.
Get your API Key at bugmail.site
Top comments (0)