Skip to content

docs(examples): add error handling example with retry strategies#191

Open
GustavoMori wants to merge 1 commit into
anthropics:mainfrom
GustavoMori:docs/error-handling-example
Open

docs(examples): add error handling example with retry strategies#191
GustavoMori wants to merge 1 commit into
anthropics:mainfrom
GustavoMori:docs/error-handling-example

Conversation

@GustavoMori

Copy link
Copy Markdown

Description

Add comprehensive error handling example demonstrating common patterns for working with the Anthropic API.

What's included

  • Error type hierarchy documentation
  • Basic error handling with specific rescue blocks
  • Built-in retry configuration (client and per-request)
  • Custom exponential backoff with jitter
  • Streaming error handling
  • Circuit breaker pattern
  • Graceful degradation strategies
  • Logging and monitoring patterns
  • Summary table of retryable vs non-retryable errors

Why

The SDK has robust error handling capabilities, but users lack practical examples showing common patterns. This example bridges that documentation gap.

Testing

  • ruby -c examples/error_handling.rb - Syntax OK
  • bundle exec rubocop examples/error_handling.rb - No offenses
  • Example executes successfully

@GustavoMori GustavoMori requested a review from a team as a code owner May 11, 2026 21:49
@rafael-pissardo

Copy link
Copy Markdown

👏

@GustavoMori

Copy link
Copy Markdown
Author

Friendly ping.
Just checking if there's any feedback or changes needed from my side. Happy to adjust the implementation if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants