diff --git a/src/labthings_fastapi/server/fallback.py b/src/labthings_fastapi/server/fallback.py index 41de9cb0..1b436aab 100644 --- a/src/labthings_fastapi/server/fallback.py +++ b/src/labthings_fastapi/server/fallback.py @@ -12,6 +12,7 @@ def __init__(self, *args, **kwargs): self.labthings_server = None self.labthings_error = None self.log_history = None + self.html_code = 500 app = FallbackApp() @@ -19,8 +20,14 @@ def __init__(self, *args, **kwargs): ERROR_PAGE = """ - + LabThings +

LabThings Could't Load

@@ -44,7 +51,7 @@ def __init__(self, *args, **kwargs): @app.get("/") async def root(): - error_message = f"{app.labthings_error!r}" + error_message = f"{app.labthings_error}" # use traceback.format_exception to get full traceback as list # this ends in newlines, but needs joining to be a single string error_w_trace = "".join(format_exception(app.labthings_error)) @@ -65,7 +72,7 @@ async def root(): logging_info = f"

Logging info

\n
{app.log_history}
" content = content.replace("{{logginginfo}}", logging_info) - return HTMLResponse(content=content, status_code=500) + return HTMLResponse(content=content, status_code=app.html_code) @app.get("/{path:path}")