Skip to content

Commit

Permalink
Merge pull request jupyterhub#3716 from minrk/pre_spawn_start_msg
Browse files Browse the repository at this point in the history
Fix error message about Authenticator.pre_spawn_start
  • Loading branch information
manics authored Dec 15, 2021
2 parents c2cbeda + bb75081 commit 92c6a23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions jupyterhub/handlers/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,13 @@ async def _wrap_spawn_single_user(
# otherwise it may cause a redirect loop
if f.done() and f.exception():
exc = f.exception()
self.log.exception(f"Error starting server {spawner._log_name}: {exc}")
if isinstance(exc, web.HTTPError):
# allow custom HTTPErrors to pass through
raise exc
raise web.HTTPError(
500,
"Error in Authenticator.pre_spawn_start: %s %s"
% (type(exc).__name__, str(exc)),
f"Unhandled error starting server {spawner._log_name}",
)
return self.redirect(pending_url)

Expand Down
2 changes: 1 addition & 1 deletion jupyterhub/tests/test_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ async def test_health_check_request(app):


async def test_pre_spawn_start_exc_no_form(app):
exc = "pre_spawn_start error"
exc = "Unhandled error starting server"

# throw exception from pre_spawn_start
async def mock_pre_spawn_start(user, spawner):
Expand Down

0 comments on commit 92c6a23

Please sign in to comment.