Skip to content
This repository has been archived by the owner on May 8, 2020. It is now read-only.

Handle global context errors (i.e. with no callback id) #286

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
8 changes: 8 additions & 0 deletions pyppeteer/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ def _on_message(self, msg: str) -> None: # noqa: C901
result = obj.get('result')
if callback and not callback.done():
callback.set_result(result)
elif obj.get('error'):
for callback in self._callbacks.values():
callback.set_exception(_createProtocolError(
callback.error, # type: ignore
callback.method, # type: ignore
obj,
))
self._callbacks = {}
else:
params = obj.get('params', {})
if obj.get('method') == 'Target.receivedMessageFromTarget':
Expand Down