mirror of
https://github.com/lnbits/lnbits.git
synced 2025-04-08 11:58:27 +02:00
fix: no stack trace for http errors
This commit is contained in:
parent
6c5f0d8a01
commit
5b8c5d52da
@ -174,6 +174,8 @@ def register_exception_handlers(app: FastAPI):
|
||||
etype, _, tb = sys.exc_info()
|
||||
traceback.print_exception(etype, exc, tb)
|
||||
logger.error(f"Exception: {str(exc)}")
|
||||
# Only the browser sends "text/html" request
|
||||
# not fail proof, but everything else get's a JSON response
|
||||
if (
|
||||
request.headers
|
||||
and "accept" in request.headers
|
||||
@ -215,8 +217,6 @@ def register_exception_handlers(app: FastAPI):
|
||||
|
||||
@app.exception_handler(HTTPException)
|
||||
async def http_exception_handler(request: Request, exc: HTTPException):
|
||||
etype, _, tb = sys.exc_info()
|
||||
traceback.print_exception(etype, exc, tb)
|
||||
logger.error(f"HTTPException {exc.status_code}: {exc.detail}")
|
||||
# Only the browser sends "text/html" request
|
||||
# not fail proof, but everything else get's a JSON response
|
||||
|
Loading…
x
Reference in New Issue
Block a user