Skip to content

Commit

Permalink
Fix exception when handling network exceptions
Browse files Browse the repository at this point in the history
Fixes #53
  • Loading branch information
Acconut committed Jan 10, 2024
1 parent e013179 commit e34fc28
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/transloadit/request.rb
Expand Up @@ -187,6 +187,11 @@ def to_query(params = nil)
def request!(&request)
Transloadit::Response.new yield
rescue RestClient::Exception => e
# The response attribute can be nil, for example for RestClient::Exceptions::OpenTimeout exceptions.
# Then, we cannot convert them into a Transloadit::Response, so instead we raise them again for
# the user to be visible.
# See https://github.com/transloadit/ruby-sdk/issues/53
raise e if e.response.nil?
Transloadit::Response.new e.response
end

Expand Down

0 comments on commit e34fc28

Please sign in to comment.