Skip to content

Commit 94c5c84

Browse files
authored
Fix exception when handling network exceptions (#67)
* Fix exception when handling network exceptions Fixes #53 * Update CHANGELOG.md
1 parent e013179 commit 94c5c84

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 3.0.1 / ????-??-??
2+
3+
- Fix `undefined method` errors when handling network exceptions [#67](https://github.com/transloadit/ruby-sdk/pull/67) (@Acconut)
4+
15
### 3.0.0 / 2024-01-10
26

37
- BREAKING: Drop support for EOL'd Ruby 2.x

lib/transloadit/request.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ def to_query(params = nil)
187187
def request!(&request)
188188
Transloadit::Response.new yield
189189
rescue RestClient::Exception => e
190+
# The response attribute can be nil, for example for RestClient::Exceptions::OpenTimeout exceptions.
191+
# Then, we cannot convert them into a Transloadit::Response, so instead we raise them again for
192+
# the user to be visible.
193+
# See https://github.com/transloadit/ruby-sdk/issues/53
194+
raise e if e.response.nil?
190195
Transloadit::Response.new e.response
191196
end
192197

0 commit comments

Comments
 (0)