Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
traceback.format_exception(...) usage that is compatible with Pytho…
Browse files Browse the repository at this point in the history
…n 3.7 and 3.11 (#15599)

* Usage that is compatible with Python 3.8 and 3.11

> Since Python 3.10, instead of passing value and tb, an exception object can
  be passed as the first argument. If value and tb are provided, the first
  argument is ignored in order to provide backwards compatibility.
>
> -- https://docs.python.org/3/library/traceback.html

* Add changelog
  • Loading branch information
MadLittleMods committed May 16, 2023
1 parent c51d2e6 commit 77cda34
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/15599.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Print full error and stack-trace of any exception that occurs during startup/initialization.
2 changes: 1 addition & 1 deletion synapse/app/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def handle_startup_exception(e: Exception) -> NoReturn:
# the reactor are written to the logs, followed by a summary to stderr.
logger.exception("Exception during startup")

error_string = "".join(traceback.format_exception(e))
error_string = "".join(traceback.format_exception(type(e), e, e.__traceback__))
indented_error_string = indent(error_string, " ")

quit_with_error(
Expand Down

0 comments on commit 77cda34

Please sign in to comment.