import static org.openhab.binding.smhi.internal.SmhiBindingConstants.*;
import java.time.ZonedDateTime;
+import java.time.format.DateTimeParseException;
import java.util.Locale;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.gson.JsonParseException;
+
/**
* Class for handling http requests to Smhi's API and return values.
*
logger.debug("Received response with status {} - {}", resp.getStatus(), resp.getReason());
switch (resp.getStatus()) {
case 200:
- return Parser.parseTimeSeries(resp.getContentAsString());
+ try {
+ return Parser.parseTimeSeries(resp.getContentAsString());
+ } catch (JsonParseException | DateTimeParseException e) {
+ throw new SmhiException(e);
+ }
case 400:
case 404:
throw new PointOutOfBoundsException();