From b458b85fbe84bd9b10e8f8ab340fdcae4952242f Mon Sep 17 00:00:00 2001
From: Lene Wasskog <lene.wasskog@nibio.no>
Date: Fri, 25 Oct 2024 12:30:47 +0200
Subject: [PATCH] refactor: Rename param, error log exception

---
 .../modules/barleynetblotch/BarleyNetBlotchModelService.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java b/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java
index 0cb49d76..f0855bed 100755
--- a/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java
+++ b/src/main/java/no/nibio/vips/logic/modules/barleynetblotch/BarleyNetBlotchModelService.java
@@ -137,7 +137,7 @@ public class BarleyNetBlotchModelService {
     public Response runModel(
             @PathParam("organizationId") Integer organizationId,
             @QueryParam("timeZone") String timeZoneStr,
-            @QueryParam("weatherdataType") String weatherdataType,
+            @QueryParam("weatherDataSourceType") String weatherDataSourceType,
             @QueryParam("latitude") String latitude,
             @QueryParam("longitude") String longitude,
             @QueryParam("weatherStationId") Integer weatherStationId,
@@ -181,7 +181,7 @@ public class BarleyNetBlotchModelService {
         List<WeatherObservation> observations;
 
 
-        if (weatherdataType != null && "weatherstation".equals(weatherdataType.trim())) {
+        if (weatherDataSourceType != null && "weatherstation".equals(weatherDataSourceType.trim())) {
             PointOfInterestWeatherStation weatherStation =
                 em.find(PointOfInterestWeatherStation.class, weatherStationId);
             LOGGER.info("Run model with weatherdata from weatherstation {}", weatherStation.getName());
@@ -223,6 +223,7 @@ public class BarleyNetBlotchModelService {
                     new HashSet<>(Collections.singletonList(WeatherObservation.LOG_INTERVAL_ID_1H))
                 );
             } catch (WeatherDataSourceException ex) {
+                LOGGER.error("Exception while getting observations for latitude={} longitude={}", latitude, longitude, ex);
                 return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ex.getMessage()).build();
             }
             if (observations == null || observations.isEmpty()) {
-- 
GitLab