Description
NativeRequest.request uses an empty rescue after making a request, skipping any Exception from being caught:
|
rescue => e |
|
puts "[ChargeBee] HTTP request failed on attempt #{attempts}: #{e}" if enable_debug |
|
|
|
if retry_enabled && attempts <= max_retries |
|
retry_delay = backoff_delay(delay_ms, attempts) |
|
sleep(retry_delay) |
|
next |
|
else |
|
raise IOError.new("IO Exception when trying to connect to ChargeBee with URL #{uri} . Reason: #{e}", e) |
|
end |
The older Rest implementation however rescues an Exception just fine:
|
rescue Exception => e |
|
raise IOError.new("IO Exception when trying to connect to chargebee with url #{opts[:url]} . Reason #{e}",e) |
This is a possible regression. The issue surfaced while upgrading from an older version that was still utilizing Rest behind the scenes for making requests. The upgrade resulted in some of our tests breaking with a now-unhandled error that inherits Exception directly, rather than StandardError. Previously this was all wrapped in a ChargeBee::IOError as seen above.
Expectation
NativeRequest.request should explicitly rescue Exceptions (then wrap them in the same ChargeBee::IOError).
(If the difference was intended, then please feel free to close the issue.)
Description
NativeRequest.requestuses an emptyrescueafter making a request, skipping anyExceptionfrom being caught:chargebee-ruby/lib/chargebee/native_request.rb
Lines 48 to 57 in 3c83e18
The older
Restimplementation however rescues anExceptionjust fine:chargebee-ruby/lib/chargebee/rest.rb
Lines 54 to 55 in 3c83e18
This is a possible regression. The issue surfaced while upgrading from an older version that was still utilizing
Restbehind the scenes for making requests. The upgrade resulted in some of our tests breaking with a now-unhandled error that inheritsExceptiondirectly, rather thanStandardError. Previously this was all wrapped in aChargeBee::IOErroras seen above.Expectation
NativeRequest.requestshould explicitly rescueExceptions (then wrap them in the sameChargeBee::IOError).(If the difference was intended, then please feel free to close the issue.)