From 7eed7fa4668b77901ad6b0d24c8ab924b21a56de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Eide?= Date: Tue, 17 Jan 2023 14:04:00 +0100 Subject: [PATCH] Catch exception from ert --- semeio/workflows/ahm_analysis/ahmanalysis.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/semeio/workflows/ahm_analysis/ahmanalysis.py b/semeio/workflows/ahm_analysis/ahmanalysis.py index 7f585aa2a..6e992c65c 100644 --- a/semeio/workflows/ahm_analysis/ahmanalysis.py +++ b/semeio/workflows/ahm_analysis/ahmanalysis.py @@ -134,13 +134,16 @@ def run( ) # Get the prior scalar parameter distributions prior_data = self.facade.load_all_gen_kw_data(prior_name) - raise_if_empty( - dataframes=[prior_data, self.facade.load_all_misfit_data(prior_name)], - messages=[ - "Empty prior ensemble", - "Empty parameters set for History Matching", - ], - ) + try: + raise_if_empty( + dataframes=[prior_data, self.facade.load_all_misfit_data(prior_name)], + messages=[ + "Empty prior ensemble", + "Empty parameters set for History Matching", + ], + ) + except KeyError as err: + raise ValidationError(f"Empty prior ensemble: {err}") from err # create dataframe with observations vectors (1 by 1 obs and also all_obs) combinations = make_obs_groups(key_map)