Skip to content

Commit

Permalink
chore: print human-readable error if index.html isn't found (#788)
Browse files Browse the repository at this point in the history
Signed-off-by: Dorian Johnson <[email protected]>
  • Loading branch information
dorianj authored Dec 1, 2020
1 parent a8c9e7a commit 6a0fbd8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion amundsen_application/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
# SPDX-License-Identifier: Apache-2.0

from typing import Any, Tuple
import logging

from flask import Flask, render_template
import jinja2
import os


ENVIRONMENT = os.getenv('APPLICATION_ENV', 'development')
LOGGER = logging.getLogger(__name__)


def init_routes(app: Flask) -> None:
Expand All @@ -16,7 +20,11 @@ def init_routes(app: Flask) -> None:


def index(path: str) -> Any:
return render_template("index.html", env=ENVIRONMENT) # pragma: no cover
try:
return render_template("index.html", env=ENVIRONMENT) # pragma: no cover
except jinja2.exceptions.TemplateNotFound as e:
LOGGER.error("index.html template not found, have you built the front-end JS (npm run build in static/?")
raise e


def healthcheck() -> Tuple[str, int]:
Expand Down

0 comments on commit 6a0fbd8

Please sign in to comment.