mirror of
https://github.com/we-promise/sure.git
synced 2026-05-12 15:15:01 +00:00
Fix error transformer to return instead of raise
The default_error_transformer should return the error object, not raise it. The with_provider_response wrapper handles the error and wraps it in a Response object. Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com>
This commit is contained in:
@@ -239,10 +239,10 @@ class Provider::TwelveData < Provider
|
||||
response_body = error.response&.dig(:body)
|
||||
status_code = error.response&.dig(:status)
|
||||
|
||||
# Detect 429 rate limit errors
|
||||
# Detect 429 rate limit errors and return RateLimitError
|
||||
if status_code == 429
|
||||
message = extract_error_message(response_body) || error.message
|
||||
raise RateLimitError.new(
|
||||
return RateLimitError.new(
|
||||
"TwelveData rate limit exceeded: #{message}",
|
||||
details: response_body
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user