diff --git a/jupyterhub/handlers/pages.py b/jupyterhub/handlers/pages.py index e97857d3..420423a7 100644 --- a/jupyterhub/handlers/pages.py +++ b/jupyterhub/handlers/pages.py @@ -281,13 +281,18 @@ class SpawnPendingHandler(BaseHandler): # Implicit spawn on /user/:name is not allowed if the user's last spawn failed. # We should point the user to Home if the most recent spawn failed. exc = spawner._spawn_future.exception() - self.log.error( - "Preventing implicit spawn for %s because last spawn failed: %s", - spawner._log_name, - exc, + self.log.error("Previous spawn for %s failed: %s", spawner._log_name, exc) + spawn_url = url_path_join(self.hub.base_url, "spawn", user.escaped_name) + self.set_status(500) + html = self.render_template( + "not_running.html", + user=user, + server_name=server_name, + spawn_url=spawn_url, + failed=True, ) - # raise a copy because each time an Exception object is re-raised, its traceback grows - raise copy.copy(exc).with_traceback(exc.__traceback__) + self.finish(html) + return # Check for pending events. This should usually be the case # when we are on this page. diff --git a/share/jupyterhub/templates/not_running.html b/share/jupyterhub/templates/not_running.html index c2ba5512..8df72546 100644 --- a/share/jupyterhub/templates/not_running.html +++ b/share/jupyterhub/templates/not_running.html @@ -5,12 +5,33 @@
Server {{ server_name }} is not running. Would you like to start it?
++ {% if failed %} + The latest attempt to start your server {{ server_name }} has failed. + Would you like to retry starting it? + {% else %} + Your server {{ server_name }} is not running. Would you like to start it? + {% endif %} +
{% endblock %} {% block start_button %} - Launch Server {{ server_name }} + {% if failed %} + Relaunch + {% else %} + Launch + {% endif %} + Server {{ server_name }} {% endblock %}