Add error handling

Make code fail gracefully.

chatgptclaude
Act as a senior developer. Add robust error handling to the code below. Cover the failure cases that matter (bad input, network, null/empty, timeouts), fail loudly where appropriate, add clear messages, and avoid swallowing errors. Return the improved code and note what you hardened. Code: [paste]

How to use this prompt

  1. Tap Copy prompt above.
  2. Replace the [bracketed] parts with your own details.
  3. Paste it into chatgpt, claude.