traceback.format_exception(...) usage that is compatible with Python 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
This commit is contained in:
Eric Eastwood 2023-05-16 08:56:42 -05:00 committed by Eric Eastwood
parent c51d2e6199
commit 77cda342be
2 changed files with 2 additions and 1 deletions

1
changelog.d/15599.bugfix Normal file
View file

@ -0,0 +1 @@
Print full error and stack-trace of any exception that occurs during startup/initialization.

View file

@ -214,7 +214,7 @@ def handle_startup_exception(e: Exception) -> NoReturn:
# the reactor are written to the logs, followed by a summary to stderr. # the reactor are written to the logs, followed by a summary to stderr.
logger.exception("Exception during startup") 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, " ") indented_error_string = indent(error_string, " ")
quit_with_error( quit_with_error(