From 978c28a2503194b1d84e086a8109a23e3f57a40f Mon Sep 17 00:00:00 2001 From: Lene Wasskog <lene.wasskog@nibio.no> Date: Fri, 25 Oct 2024 11:02:25 +0200 Subject: [PATCH] log: Error log exception, do not swallow it --- .../no/nibio/vips/logic/service/ModelFormService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/no/nibio/vips/logic/service/ModelFormService.java b/src/main/java/no/nibio/vips/logic/service/ModelFormService.java index c1c739ba..f369d438 100644 --- a/src/main/java/no/nibio/vips/logic/service/ModelFormService.java +++ b/src/main/java/no/nibio/vips/logic/service/ModelFormService.java @@ -53,6 +53,8 @@ import no.nibio.vips.util.ParseRESTParamUtil; import no.nibio.vips.util.WeatherUtil; import no.nibio.vips.util.XDate; import no.nibio.vips.util.weather.WeatherDataSourceUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This is a collection of (one) service(s) for models run from forms (not as part of batch) @@ -62,7 +64,9 @@ import no.nibio.vips.util.weather.WeatherDataSourceUtil; @Path("rest/modelform") @Facet("restricted") public class ModelFormService { - + private static final Logger LOGGER = LoggerFactory.getLogger(ModelFormService.class); + + @EJB UserBean userBean; @EJB @@ -196,14 +200,15 @@ public class ModelFormService { Integer VIPSCoreUserId = organization.getDefaultVipsCoreUserId(); - List<Result>results = forecastBean.runForecast(mConf, VIPSCoreUserId); + List<Result> results = forecastBean.runForecast(mConf, VIPSCoreUserId); return Response.ok().entity(results).build(); } catch(PreprocessorException |RunModelException ex) { + LOGGER.error("Exception occurred when attempting to run the septoria humidity model", ex); return Response.serverError().entity(ex.getMessage()).build(); - } + } } private ForecastModelConfiguration getForecastModelConfiguration(String modelId, String key, String value) -- GitLab