Skip to content

Commit

Permalink
Remove template based custom error and 404 pages
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Nov 27, 2024
1 parent 28dc23c commit d8816cf
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 41 deletions.
4 changes: 1 addition & 3 deletions binderhub/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)
from traitlets.config import Application

from .base import Custom404, VersionHandler
from .base import VersionHandler
from .build import BuildExecutor, KubernetesBuildExecutor, KubernetesCleaner
from .builder import BuildHandler
from .events import EventLog
Expand Down Expand Up @@ -1074,8 +1074,6 @@ def initialize(self, *args, **kwargs):
),
(r"/.*", UIHandler),
]
# This needs to be the last handler in the list, because it needs to match "everything else"
handlers.append((r".*", Custom404))
handlers = self.add_url_prefix(self.base_url, handlers)
if self.extra_static_path:
handlers.insert(
Expand Down
22 changes: 0 additions & 22 deletions binderhub/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import json
import urllib.parse
from http.client import responses

import jwt
from jupyterhub.services.auth import HubOAuth, HubOAuthenticated
Expand Down Expand Up @@ -204,31 +203,10 @@ def extract_message(self, exc_info):
except Exception:
return ""

def write_error(self, status_code, **kwargs):
exc_info = kwargs.get("exc_info")
message = ""
status_message = responses.get(status_code, "Unknown HTTP Error")
if exc_info:
message = self.extract_message(exc_info)

self.render_template(
"error.html",
status_code=status_code,
status_message=status_message,
message=message,
)

def options(self, *args, **kwargs):
pass


class Custom404(BaseHandler):
"""Raise a 404 error, rendering the error.html template"""

def prepare(self):
raise web.HTTPError(404)


class VersionHandler(BaseHandler):
"""Serve information about versions running"""

Expand Down
16 changes: 0 additions & 16 deletions binderhub/templates/error.html

This file was deleted.

0 comments on commit d8816cf

Please sign in to comment.