diff --git a/lib/action_push_native/service/network_error_handling.rb b/lib/action_push_native/service/network_error_handling.rb index b36b306..b2552fa 100644 --- a/lib/action_push_native/service/network_error_handling.rb +++ b/lib/action_push_native/service/network_error_handling.rb @@ -3,6 +3,8 @@ module ActionPushNative::Service::NetworkErrorHandling def handle_network_error(error) case error + when HTTPX::PoolTimeoutError + raise error when Errno::ETIMEDOUT, HTTPX::TimeoutError raise ActionPushNative::TimeoutError, error.message when Errno::ECONNRESET, Errno::ECONNABORTED, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, diff --git a/test/lib/action_push_native/service/apns_test.rb b/test/lib/action_push_native/service/apns_test.rb index 2d9a2fb..9615f93 100644 --- a/test/lib/action_push_native/service/apns_test.rb +++ b/test/lib/action_push_native/service/apns_test.rb @@ -82,6 +82,13 @@ class ApnsTest < ActiveSupport::TestCase assert_raises ActionPushNative::ConnectionError do @apns.push(@notification) end + + stub_request(:post, "https://api.push.apple.com/3/device/123"). + to_raise(HTTPX::PoolTimeoutError.new(5, "Timed out after 5 seconds while waiting for a connection")) + + assert_raises HTTPX::PoolTimeoutError do + @apns.push(@notification) + end end test "push apns payload can be overridden" do