From 6eb42b4e329b7c64be0067ec476a5b1cc7a0e5f8 Mon Sep 17 00:00:00 2001 From: angrybayblade Date: Thu, 14 Mar 2024 10:53:23 +0530 Subject: [PATCH] feat: add traceback logging --- operate/http/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/operate/http/__init__.py b/operate/http/__init__.py index 0151f8ba4..df87a575a 100644 --- a/operate/http/__init__.py +++ b/operate/http/__init__.py @@ -20,6 +20,7 @@ """Local resource as an HTTP object.""" import json +import traceback import typing as t from abc import ABC @@ -138,8 +139,10 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> t.Any: status_code=e.code, ) except Exception as e: # pylint: disable=broad-except + tb = traceback.format_exc() response = JSONResponse( - content={"error": str(e)}, + content={"error": str(e), "traceback": tb}, status_code=500, ) + print(tb) await response(scope=scope, receive=receive, send=send)