Skip to content
BackendIntermediateVersion 1.0Works with any capable model

Backend Error Handling Review

Review a piece of backend code for swallowed errors, leaky messages, missing cleanup and unsafe retries.

When to use it

Use it on a service function, a request handler or a background job that talks to a database or another service. It points at the places where a failure would be hidden, misreported or left half-finished, with the specific lines to look at.

When not to use it: Skip it for code that has no failure paths worth reviewing, or code so large that the assistant cannot see the callers. It cannot confirm runtime behaviour; do not take its claims as test results.

Required inputs

PlaceholderWhat to provideExample
{{code}}The code under review, with line numbers if you can add them. Remove secrets and real data first.An async function sendInvoiceReminder(invoiceId) that loads an invoice, calls an email API and marks it as reminded.
{{language_and_framework}}Language, framework and how errors normally travel in this codebase.TypeScript on Express; errors are thrown and caught by a central error middleware.
{{failure_context}}What can fail around this code and what must never happen.The email API times out sometimes. A customer must never get two reminders for the same invoice.

The prompt

Fill in each {{placeholder}} before you send it.

You are a backend engineer reviewing code specifically for error handling. Do not review style or performance.

<code>
{{code}}
</code>

<language_and_framework>
{{language_and_framework}}
</language_and_framework>

<failure_context>
{{failure_context}}
</failure_context>

For each finding, check these categories:
- Swallowed or hidden errors: empty catch blocks, logging without rethrowing, returning success after a failure.
- Wrong error type or status: client faults reported as server faults and the reverse.
- Information leaks: internal messages, stack traces or identifiers returned to callers.
- Partial failure: steps that change state before a later step can fail, with no rollback or compensation.
- Retries and repeats: operations that are unsafe to run twice, retries without a limit or delay, and timeouts that are missing.
- Resource cleanup: connections, locks, files or transactions not released on the failure path.
- Logging: failures logged without enough context to diagnose, or with sensitive values.

Rules:
- Cite the line or quote the fragment for every finding.
- Report a problem only if you can describe a concrete sequence of events that triggers it. If you suspect something but cannot see the callers or configuration, mark the finding "Needs confirmation" and say what to check.
- Do not rewrite the whole function. Give a minimal fix for each finding, as a short snippet or a description.
- Do not claim the code was run. If a behaviour depends on the library, say which library behaviour you are assuming.

Output format:
Findings, ordered by severity, each as: Severity (High, Medium, Low) | Location | Trigger sequence | Consequence | Minimal fix | Confidence
Failure scenarios not covered by the code
Questions

Expected output

A prioritised list of findings in which each entry quotes the code, describes the exact sequence of events that triggers it, and offers a small fix. For the reminder example, a good review spots that the invoice is marked as reminded only after the email call, so a timeout after a successful send leads to a duplicate email on retry. It also separates confirmed problems from ones that need checking.

Sample response (excerpt)Illustrative — your output will differ
F1 | High | lines 14-18: await emailApi.send(...); await markReminded(id) | The email is sent, the response times out, the function throws, and the retry sends the email again because markReminded never ran. | Record the intent first (status "sending") and use an idempotency key on the send call, if the email API supports one. | Needs confirmation: does the API support idempotency keys?
F2 | Medium | line 22: catch (e) { console.log("failed") } | The error is swallowed and the caller sees success. | Log the invoice id and error, then rethrow. | High confidence

Limitations

  • Without the callers, configuration and library versions the assistant can only reason about the code in front of it. Some findings will be wrong because of context it could not see.
  • It may report theoretical problems that your framework already handles, such as central error middleware. Describe that handling in the failure context.
  • It can miss problems in code you did not paste, such as a helper that swallows errors.
  • Suggested fixes can introduce new bugs. They need the same review and testing as any other change.

How to validate the output

Do these before relying on anything the model returns.

Written by
PromptFable Editorial
Last updated 13 Nov 2026
Review
Not yet reviewed

PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.