Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/action_push_native/service/network_error_handling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions test/lib/action_push_native/service/apns_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down