This commit is contained in:
2026-04-13 17:19:00 +08:00
parent bf1ce4b7f2
commit a913ce9548
2 changed files with 5 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "common"
description = "Reusable code stubs"
version = "0.1.3"
version = "0.1.4"
requires-python = ">=3.13"
authors = [
{ name="BreakerBear", email="breakerbear@autistic.men" },

View File

@@ -123,11 +123,15 @@ async def handler(request: ws.WebSocketRequest):
mid = inbound.id
res = inbound.fulfill()
except json.decoder.JSONDecodeError: err = Error.PARSE_ERROR
except Request.ParamsError: err = Error.INVALID_PARAMS
except TypeError: err = Error.INVALID_REQUEST
except KeyError: err = Error.METHOD_NOT_FOUND
except Exception as e:
err = Error.INTERNAL_ERROR
exc = e
except ws.ConnectionClosed as e:
logger.critical('Going away', exc_info=e)
return
if err is not None: logger.error(err.message(), exc_info=exc)
if mid is not None: await connection.send_message(str(Response(mid, err or res)))