summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--changelog.d/15569.feature1
-rw-r--r--synapse/app/_base.py7
2 files changed, 7 insertions, 1 deletions
diff --git a/changelog.d/15569.feature b/changelog.d/15569.feature
new file mode 100644
index 0000000000..b58af8ad55
--- /dev/null
+++ b/changelog.d/15569.feature
@@ -0,0 +1 @@
+Print full error and stack-trace of any exception that occurs during startup/initialization.
diff --git a/synapse/app/_base.py b/synapse/app/_base.py
index 7f83b34d89..4dfcf484fa 100644
--- a/synapse/app/_base.py
+++ b/synapse/app/_base.py
@@ -21,6 +21,7 @@ import socket
 import sys
 import traceback
 import warnings
+from textwrap import indent
 from typing import (
     TYPE_CHECKING,
     Any,
@@ -212,8 +213,12 @@ def handle_startup_exception(e: Exception) -> NoReturn:
     # Exceptions that occur between setting up the logging and forking or starting
     # 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))
+    indented_error_string = indent(error_string, "    ")
+
     quit_with_error(
-        f"Error during initialisation:\n   {e}\nThere may be more information in the logs."
+        f"Error during initialisation:\n{indented_error_string}\nThere may be more information in the logs."
     )