Skip to content

Commit d942235

Browse files
committed
fix: apply PR suggestion
1 parent 790825a commit d942235

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/openedx_tagging/rest_api/v1/exception_handlers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ def _custom_exception_handler(exc: Exception, context: dict) -> Response | None:
3131
if is_expected_exception:
3232
return exception_handler(exc, context)
3333

34-
# Making really sure that any unexpected exception gets logged
35-
log.error(exc, stack_info=True, exc_info=True)
34+
# DRF always calls exception handlers from within an `except:` block, so we can assume
35+
# that `log.exception` will automatically insert those exception details and a stack trace.
36+
log.exception("Unexpected exception while handling API request")
3637

3738
if settings.DEBUG:
3839
description_with_traceback = f"{exc.__class__.__name__}: {str(exc)}\n\nTraceback:\n{traceback.format_exc()}"

0 commit comments

Comments
 (0)