Skip to content

Commit

Permalink
Use logger error instead of exception (#1692)
Browse files Browse the repository at this point in the history
Fixes the `Nonetype: None` issue that shows up in the logging.

It is caused by using `logging.exception` while not in an exception
handler.

I don't know whether including the full traceback makes sense in the
logging, but that could also be possible by adding `exc_info=exc`
  • Loading branch information
Ruwann committed Apr 24, 2023
1 parent c3e2e57 commit 128a8e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions connexion/middleware/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, next_app: ASGIApp):

@staticmethod
def problem_handler(_request: StarletteRequest, exc: ProblemException):
logger.exception(exc)
logger.error(exc)

response = exc.to_problem()

Expand All @@ -35,7 +35,7 @@ def problem_handler(_request: StarletteRequest, exc: ProblemException):

@staticmethod
def http_exception(_request: StarletteRequest, exc: HTTPException) -> Response:
logger.exception(exc)
logger.error(exc)

headers = exc.headers

Expand All @@ -52,7 +52,7 @@ def http_exception(_request: StarletteRequest, exc: HTTPException) -> Response:

@staticmethod
def common_error_handler(_request: StarletteRequest, exc: Exception) -> Response:
logger.exception(exc)
logger.error(exc)

response = InternalServerError().to_problem()

Expand Down

0 comments on commit 128a8e0

Please sign in to comment.