Skip to content

Commit

Permalink
Merge pull request #40 from valory-xyz/feat/add-500-logging
Browse files Browse the repository at this point in the history
Add traceback logging
  • Loading branch information
angrybayblade authored Mar 14, 2024
2 parents a322a6b + 6eb42b4 commit 2242198
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion operate/http/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""Local resource as an HTTP object."""

import json
import traceback
import typing as t
from abc import ABC

Expand Down Expand Up @@ -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)

0 comments on commit 2242198

Please sign in to comment.