GeminiSpark

Robust Error Handling Strategy

When writing critical code that needs to handle failures predictably.

Prompt

Design an error handling strategy for the following [LANGUAGE] function/class. Consider exception types, logging, user-friendly messages, retry policies, and graceful degradation. Provide a code example implementing the strategy. Code: [CODE SNIPPET]

Fill in these

Swap each placeholder for your own value:

  • [LANGUAGE]
  • [CODE SNIPPET]

Pro tips

  • Describe the execution context (e.g., API request, background job) to define appropriate error responses.
  • If there are external dependencies, mention them to plan for transient failures.

Want to run prompts like this for free?

Try GeminiOmni — a free playground for Gemini-powered chat, images and video.

Try These Prompts Free

Related prompts