Skip to content

Commit bb75081

Browse files
committed
Fix error message about pre_spawn_start
This isn't the only or even main thing likely to raise here, so don't blame it, which is confusing, especially in a message shown to users. Log the full exception, and show a more opaque message to the user to avoid confusion
1 parent 028722a commit bb75081

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

jupyterhub/handlers/pages.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,13 @@ async def _wrap_spawn_single_user(
308308
# otherwise it may cause a redirect loop
309309
if f.done() and f.exception():
310310
exc = f.exception()
311+
self.log.exception(f"Error starting server {spawner._log_name}: {exc}")
312+
if isinstance(exc, web.HTTPError):
313+
# allow custom HTTPErrors to pass through
314+
raise exc
311315
raise web.HTTPError(
312316
500,
313-
"Error in Authenticator.pre_spawn_start: %s %s"
314-
% (type(exc).__name__, str(exc)),
317+
f"Unhandled error starting server {spawner._log_name}",
315318
)
316319
return self.redirect(pending_url)
317320

jupyterhub/tests/test_pages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ async def test_health_check_request(app):
11291129

11301130

11311131
async def test_pre_spawn_start_exc_no_form(app):
1132-
exc = "pre_spawn_start error"
1132+
exc = "Unhandled error starting server"
11331133

11341134
# throw exception from pre_spawn_start
11351135
async def mock_pre_spawn_start(user, spawner):

0 commit comments

Comments
 (0)