Skip to content

Commit

Permalink
Fix exception when handling network exceptions (#67)
Browse files Browse the repository at this point in the history
* Fix exception when handling network exceptions

Fixes #53

* Update CHANGELOG.md
  • Loading branch information
Acconut committed Jan 10, 2024
1 parent e013179 commit 94c5c84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
### 3.0.1 / ????-??-??

- Fix `undefined method` errors when handling network exceptions [#67](https://github.com/transloadit/ruby-sdk/pull/67) (@Acconut)

### 3.0.0 / 2024-01-10

- BREAKING: Drop support for EOL'd Ruby 2.x
Expand Down
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 94c5c84

Please sign in to comment.