lib/puppeteer/web_socket.rb in puppeteer-ruby-0.0.16 vs lib/puppeteer/web_socket.rb in puppeteer-ruby-0.0.17
- old
+ new
@@ -14,14 +14,18 @@
attr_reader :url
def write(data)
@socket.write(data)
+ rescue Errno::EPIPE
+ raise EOFError.new('already closed')
end
def readpartial(maxlen = 1024)
@socket.readpartial(maxlen)
+ rescue Errno::ECONNRESET
+ raise EOFError.new('closed by remote')
end
end
STATE_CONNECTING = 0
STATE_OPENED = 1
@@ -38,9 +42,12 @@
Thread.new do
wait_for_data until @ready_state >= STATE_CLOSING
rescue EOFError
# Google Chrome was gone.
# We have nothing todo. Just finish polling.
+ if @ready_state < STATE_CLOSING
+ handle_on_close(reason: 'Going Away', code: 1001)
+ end
end
end
class TransportError < StandardError; end