Exception: ActiveGenie::ProviderServerError
- Inherits:
-
StandardError
- Object
- StandardError
- ActiveGenie::ProviderServerError
- Defined in:
- lib/active_genie/errors/provider_server_error.rb
Constant Summary collapse
- TEXT =
<<~TEXT Provider server error: %<code>s %<body>s Providers errors are common and can occur for various reasons, such as: - Invalid API key - Exceeded usage limits - Temporary server issues Be ready to handle these errors gracefully in your application. We recommend implementing retry logic and exponential backoff strategies. Usually async workers layer is the ideal place to handle such errors. TEXT
Instance Method Summary collapse
-
#initialize(response) ⇒ ProviderServerError
constructor
A new instance of ProviderServerError.
Constructor Details
#initialize(response) ⇒ ProviderServerError
Returns a new instance of ProviderServerError.
18 19 20 21 22 23 24 |
# File 'lib/active_genie/errors/provider_server_error.rb', line 18 def initialize(response) super(format( TEXT, code: response&.code.to_s, body: response&.body.to_s.strip.empty? ? '(no body)' : response&.body.to_s )) end |