-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Description
NativeRequest.request uses an empty rescue after making a request, skipping any Exception from being caught:
chargebee-ruby/lib/chargebee/native_request.rb
Lines 48 to 57 in 3c83e18
| 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:
chargebee-ruby/lib/chargebee/rest.rb
Lines 54 to 55 in 3c83e18
| 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.)