Skip to content

Commit 4298514

Browse files
committed
Correctly catch and re-raise HTTPX PoolTimeoutErrors
1 parent c4dabac commit 4298514

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/action_push_native/service/network_error_handling.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module ActionPushNative::Service::NetworkErrorHandling
33

44
def handle_network_error(error)
55
case error
6+
when HTTPX::PoolTimeoutError
7+
raise error
68
when Errno::ETIMEDOUT, HTTPX::TimeoutError
79
raise ActionPushNative::TimeoutError, error.message
810
when Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH,

test/lib/action_push_native/service/apns_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,13 @@ class ApnsTest < ActiveSupport::TestCase
8282
assert_raises ActionPushNative::ConnectionError do
8383
@apns.push(@notification)
8484
end
85+
86+
stub_request(:post, "https://api.push.apple.com/3/device/123").
87+
to_raise(HTTPX::PoolTimeoutError.new(5, "Timed out after 5 seconds while waiting for a connection"))
88+
89+
assert_raises HTTPX::PoolTimeoutError do
90+
@apns.push(@notification)
91+
end
8592
end
8693

8794
test "push apns payload can be overridden" do

0 commit comments

Comments
 (0)