Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit ff4319f

Browse files
committed
listener: raise all errors
Signed-off-by: Sumner Evans <[email protected]>
1 parent aaaa87e commit ff4319f

File tree

3 files changed

+8
-16
lines changed

3 files changed

+8
-16
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ repos:
99
- id: check-added-large-files
1010

1111
- repo: https://github.com/tox-dev/pyproject-fmt
12-
rev: 0.9.1
12+
rev: 0.9.2
1313
hooks:
1414
- id: pyproject-fmt
1515

@@ -36,7 +36,7 @@ repos:
3636

3737
# mypy
3838
- repo: https://github.com/pre-commit/mirrors-mypy
39-
rev: v1.0.0
39+
rev: v1.1.1
4040
hooks:
4141
- id: mypy
4242
additional_dependencies: [types-termcolor==1.1.3]

cicd/custom_style_check.py

-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,4 @@ def check_file(path: Path) -> bool:
6767
with open(Path("CHANGELOG.md")) as f:
6868
assert f.readline().strip() == f"# v{version}", "Version mismatch: CHANGELOG"
6969

70-
7170
sys.exit(0 if valid else 1)

linkedin_messaging/linkedin.py

+6-13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from typing import Any, AsyncGenerator, Awaitable, Callable, Optional, TypeVar, Union, cast
88

99
import aiohttp
10+
import aiohttp.client_exceptions
1011
from bs4 import BeautifulSoup
1112
from dataclasses_json.api import DataClassJsonMixin
1213

@@ -501,12 +502,10 @@ def add_event_listener(
501502
],
502503
):
503504
"""
504-
There are three special event types:
505+
There is one special event type:
505506
506-
* ALL_EVENTS - an event fired on every event, and which contains the entirety of
507-
the raw event payload
508-
* TIMEOUT - an event fired if the event listener connection times out
509-
* STREAM_ERROR - an event fired if the event stream errors for any other reason
507+
* ``ALL_EVENTS`` - an event fired on every event, and which contains the entirety of the
508+
raw event payload
510509
"""
511510
self.event_listeners[payload_key].append(fn)
512511

@@ -571,13 +570,7 @@ async def start_listener(self):
571570
except Exception:
572571
logging.exception(f"Handler {handler} failed to handle {te}")
573572
except Exception as e:
574-
logging.exception(f"Error listening to event stream: {e}")
575-
# Special handling for STREAM_ERROR handler.
576-
if stream_error_handlers := self.event_listeners.get("STREAM_ERROR"):
577-
for handler in stream_error_handlers:
578-
try:
579-
await handler(e)
580-
except Exception:
581-
logging.exception(f"Handler {handler} failed to handle {e}")
573+
logging.exception(f"Got exception in listener: {e}")
574+
raise
582575

583576
# endregion

0 commit comments

Comments
 (0)