Skip to content

Commit

Permalink
added error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
grallewellyn committed Dec 5, 2024
1 parent cd65253 commit a0521be
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions api/endpoints/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,14 @@ def get(self, ade_host):


def get_config(ade_host):
ROOT = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(ROOT, "environments.json")) as f:
data = json.load(f)
try:
ROOT = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(ROOT, "environments.json")) as f:
data = json.load(f)
except FileNotFoundError:
msg = "environments.json file could not be found"
logging.exception(msg)
raise Exception(msg)

base_url = "{0.netloc}".format(urlsplit(urllib.parse.unquote(ade_host)))

Expand Down

0 comments on commit a0521be

Please sign in to comment.