Skip to content
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

Merged
merged 3 commits into from
Mar 13, 2020

Conversation

sanderegg
Copy link
Member

What do these changes do?

  • catch exception arising in socket.io connection

Related issue number

How to test

Checklist

  • Did you change any service's API? Then make sure to bundle document and upgrade version (make openapi-specs, git commit ... and then make version-*)
  • Unit tests for the changes exist
  • Runs in the swarm
  • Documentation reflects the changes
  • New module? Add your github username to .github/CODEOWNERS

@sanderegg sanderegg added this to the Dim Sum milestone Mar 13, 2020
@sanderegg sanderegg requested review from pcrespov and odeimaiz March 13, 2020 13:52
@sanderegg sanderegg self-assigned this Mar 13, 2020
@sanderegg sanderegg changed the title catch exception on sockteio connection catch exception on socketio connection Mar 13, 2020
@codecov
Copy link

codecov bot commented Mar 13, 2020

Codecov Report

Merging #1365 into master will decrease coverage by 0.03%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#integrationtests 57.57% <66.66%> (+0.01%) ⬆️
#unittests 66.75% <73.33%> (-0.03%) ⬇️
Impacted Files Coverage Δ
...src/simcore_service_webserver/socketio/handlers.py 87.5% <71.42%> (-3.55%) ⬇️
...mcore_service_webserver/socketio/handlers_utils.py 92.59% <75%> (-7.41%) ⬇️
.../director/src/simcore_service_director/producer.py 66.75% <0%> (-0.26%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 38f9c66...b29d41f. Read the comment docs.

Copy link
Member

@odeimaiz odeimaiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catch 'em all

@sanderegg sanderegg merged commit d47b3f1 into ITISFoundation:master Mar 13, 2020
@sanderegg sanderegg deleted the bugfix/exception_socketio branch March 13, 2020 15:53
@@ -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")
Copy link
Member

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:
Copy link
Member

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

@sanderegg sanderegg linked an issue Apr 6, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

platform stability
3 participants