Skip to content

Commit

Permalink
Pass FileNotFoundError exceptions in likelihood through (LSSTDESC#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
tilmantroester authored and am610 committed Nov 23, 2022
1 parent d4c94ee commit 82277ad
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions firecrown/likelihood/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ def load_likelihood(filename: str) -> Likelihood:
if spec.loader is None:
raise ImportError(f"Spec for module '{modname}' has no loader.")

try:
spec.loader.exec_module(mod)
except FileNotFoundError as error:
raise ImportError(f"{error.strerror}: {filename}") from error
spec.loader.exec_module(mod)

if not hasattr(mod, "likelihood"):
raise ValueError(
Expand Down

0 comments on commit 82277ad

Please sign in to comment.