Skip to content

Commit

Permalink
Fixed #303
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed Dec 27, 2023
1 parent aaea3d4 commit f595dcc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,13 @@ private Signal<Double, Void> convert(Signal<String, Void> signal) {

return new Signal<>(signal.timestamp, value);

} catch (JsonProcessingException e) {
throw new IllegalStateException("Can't parse JSON: " + signal.getValue(), e);
} catch (JsonProcessingException ex) {

// Throwing an exception here breaks everything
// https://github.com/home-climate-control/dz/issues/303

logger.error("Can't parse JSON:\n{}\n---", signal.getValue(), ex);
return new Signal<>(signal.timestamp, null, signal.payload, Signal.Status.FAILURE_TOTAL, ex);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,12 @@ protected void parseState(MqttSignal message) {

stateSink.tryEmitNext(getStateSignal());

} catch (JsonProcessingException e) {
throw new IllegalStateException("Can't parse JSON: " + message, e);
} catch (JsonProcessingException ex) {

// Throwing an exception here breaks everything
// https://github.com/home-climate-control/dz/issues/303

logger.error("Can't parse JSON:\n{}\n---", message, ex);
} finally {
ThreadContext.pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ protected void parseState(MqttSignal message) {

actual = Boolean.valueOf(payload.get("value").toString());

} catch (JsonProcessingException e) {
} catch (JsonProcessingException ex) {

actual = null;
throw new IllegalStateException("Can't parse JSON: " + message, e);

// Throwing an exception here breaks everything
// https://github.com/home-climate-control/dz/issues/303

logger.error("Can't parse JSON:\n{}\n---", message, ex);


} finally {
ThreadContext.pop();
Expand Down

0 comments on commit f595dcc

Please sign in to comment.