-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
catch exception on socketio connection #1365
catch exception on socketio connection #1365
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1365 +/- ##
=========================================
- Coverage 72.64% 72.6% -0.04%
=========================================
Files 201 201
Lines 8426 8437 +11
Branches 945 947 +2
=========================================
+ Hits 6121 6126 +5
- Misses 2028 2032 +4
- Partials 277 279 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catch 'em all
@@ -42,7 +44,9 @@ | |||
try: | |||
await authenticate_user(sid, app, request) | |||
except web.HTTPUnauthorized: | |||
raise socket_io_connection_error("authentification failed") | |||
raise SocketIOConnectionError("authentification failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor Minor: capitalize :-)
] | ||
app[APP_CLIENT_SOCKET_DECORATED_HANDLERS_KEY] = partial_fcts | ||
# register the fcts | ||
for func in partial_fcts: | ||
sio.on(func.__name__, handler=func) | ||
|
||
|
||
def register_socketio_handler(func: callable) -> callable: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MINOR:
from typing import Callable, Dict, Optional
HandlerT = Callable[[str, Dict, web.Application], Optional[bool]]
def register_socketio_handler(func: HandlerT) -> HandlerT:
And can even use HandlerT
to assert signature below or moreover, perhaps mypy
will catch issues when decorating functions of different signature
What do these changes do?
Related issue number
How to test
Checklist
make openapi-specs
,git commit ...
and thenmake version-*
)