From 56694fde614b79990d404d32d53bbeaa32802d64 Mon Sep 17 00:00:00 2001 From: Brian Krabach Date: Wed, 1 Apr 2026 12:44:31 -0700 Subject: [PATCH] style: add debug logging to ws relay exceptions; format test_frontend_css --- muxplex/main.py | 24 ++++++++++++------------ muxplex/tests/test_frontend_css.py | 4 +++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/muxplex/main.py b/muxplex/main.py index 5d8cefa..7d6cc3e 100644 --- a/muxplex/main.py +++ b/muxplex/main.py @@ -677,8 +677,8 @@ async def terminal_ws_proxy(websocket: WebSocket) -> None: await ttyd_ws.send(msg["bytes"]) elif msg.get("text"): await ttyd_ws.send(msg["text"]) - except Exception: - pass + except Exception as exc: + _log.debug("ws relay closed (client_to_ttyd): %s", exc) async def ttyd_to_client() -> None: try: @@ -687,12 +687,12 @@ async def terminal_ws_proxy(websocket: WebSocket) -> None: await websocket.send_bytes(message) else: await websocket.send_text(message) - except Exception: - pass + except Exception as exc: + _log.debug("ws relay closed (ttyd_to_client): %s", exc) await asyncio.gather(client_to_ttyd(), ttyd_to_client()) - except Exception: - pass + except Exception as exc: + _log.debug("ws proxy closed: %s", exc) finally: try: await websocket.close() @@ -756,8 +756,8 @@ async def federation_terminal_ws_proxy(websocket: WebSocket, remote_id: int) -> await remote_ws.send(msg["bytes"]) elif msg.get("text"): await remote_ws.send(msg["text"]) - except Exception: - pass + except Exception as exc: + _log.debug("federation ws relay closed (client_to_remote): %s", exc) async def remote_to_client() -> None: try: @@ -766,12 +766,12 @@ async def federation_terminal_ws_proxy(websocket: WebSocket, remote_id: int) -> await websocket.send_bytes(message) else: await websocket.send_text(message) - except Exception: - pass + except Exception as exc: + _log.debug("federation ws relay closed (remote_to_client): %s", exc) await asyncio.gather(client_to_remote(), remote_to_client()) - except Exception: - pass + except Exception as exc: + _log.debug("federation ws proxy closed: %s", exc) finally: try: await websocket.close() diff --git a/muxplex/tests/test_frontend_css.py b/muxplex/tests/test_frontend_css.py index 345a6a4..ddc45a5 100644 --- a/muxplex/tests/test_frontend_css.py +++ b/muxplex/tests/test_frontend_css.py @@ -2089,4 +2089,6 @@ def test_custom_scrollbar_styles(): css = read_css() assert "scrollbar-width: thin" in css, "Firefox scrollbar-width must be set" assert "::-webkit-scrollbar" in css, "WebKit scrollbar rules must exist" - assert "border-radius: 3px" in css or "border-radius:3px" in css, "scrollbar thumb must be rounded" + assert "border-radius: 3px" in css or "border-radius:3px" in css, ( + "scrollbar thumb must be rounded" + )