Skip to content

Commit

Permalink
Make sure exceptions don't get hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 committed Nov 27, 2023
1 parent 031a368 commit 1a1d4c5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sanescansrv/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,13 +623,18 @@ def serve_scanner(

trio.run(serve_async, app, config_obj)
except BaseExceptionGroup_ as exc:
caught = False
for ex in exc.exceptions:
if isinstance(ex, KeyboardInterrupt):
log("Shutting down from keyboard interrupt")
caught = True
break
if isinstance(ex, OSError):
log(f"Cannot bind to IP address '{ip_addr}' port {port}", 2)
caught = True
sys.exit(1)
if not caught:
raise


def run() -> None:
Expand Down

0 comments on commit 1a1d4c5

Please sign in to comment.