-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[darksky] Added warning if parsing of 'location' parameter throws exception #7831
Conversation
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
...main/java/org/openhab/binding/darksky/internal/handler/DarkSkyWeatherAndForecastHandler.java
Outdated
Show resolved
Hide resolved
…binding/darksky/internal/handler/DarkSkyWeatherAndForecastHandler.java Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
@@ -136,9 +136,10 @@ public void initialize() { | |||
try { | |||
location = new PointType(config.location); | |||
} catch (IllegalArgumentException e) { | |||
location = null; | |||
logger.warn("Error parsing 'location' parameter: {}", e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually request such logs to be removed, as thing status changes are logged anyway. Why can't we add the message to the thing status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is right. I thought about that too. But why I did not do it was because the error message of the exception is not localized. It is English. The ThingStatus
descriptions in this binding are translatable which could look a little bit weird if you have a mixture of languages in it.
I am brainstorming about a solution for localized exception messages in OHC for a while now. Do not know if it is really worth the effort to spend time on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had a look at the PointType
class. As far as I can see there are three cases where an IAE is thrown: empty string, less than two parts, more than three parts, so all are related to the format. What additional information do we get by logging the message? Probably the thing status message shpuld be a bit more clear that the format of location
is wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much effort should I spend on a dead binding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is whether we shoulc hange anything at all then...
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> Signed-off-by: CSchlipp <christian@schlipp.de>
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de> Signed-off-by: Daan Meijer <daan@studioseptember.nl>
…eption (openhab#7831) * Added warning if parsing of 'location' parameter throws exception Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Christoph Weitkamp github@christophweitkamp.de