From 2cb9ee381fcc738912e98893733f671df34a7cc1 Mon Sep 17 00:00:00 2001 From: phact Date: Tue, 27 Aug 2024 14:44:33 -0400 Subject: [PATCH] dbid check --- impl/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/impl/main.py b/impl/main.py index a976165..88f90fd 100644 --- a/impl/main.py +++ b/impl/main.py @@ -114,7 +114,10 @@ async def dispatch(self, request: Request, call_next): response = await call_next(request) return response except Exception as e: - logger.error(f"Error: {e}, dbid: {request.state.dbid}") + if hasattr(request.state, "dbid"): + logger.error(f"Error: {e}, dbid: {request.state.dbid}") + else: + logger.error(f"Error: {e}") print(e) raise e