]> git.basschouten.com Git - openhab-addons.git/commitdiff
Log invalid number when expecting numeric response from projector (#13549)
authormlobstein <michael.lobstein@gmail.com>
Sat, 15 Oct 2022 07:33:12 +0000 (02:33 -0500)
committerGitHub <noreply@github.com>
Sat, 15 Oct 2022 07:33:12 +0000 (09:33 +0200)
Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
bundles/org.openhab.binding.benqprojector/src/main/java/org/openhab/binding/benqprojector/internal/BenqProjectorDevice.java

index 090de76178e7fe9ee05bdf6232f9062408f842a1..b14dddf5fd84f9bf58a0fef36c6973563bdc6f01 100644 (file)
@@ -92,7 +92,12 @@ public class BenqProjectorDevice {
 
     protected int queryInt(String query) throws BenqProjectorCommandException, BenqProjectorException {
         String response = sendQuery(query);
-        return Integer.parseInt(response);
+        try {
+            return Integer.parseInt(response);
+        } catch (NumberFormatException nfe) {
+            throw new BenqProjectorCommandException(
+                    "Unable to parse response '" + response + "' as Integer for command: " + query);
+        }
     }
 
     protected String queryString(String query) throws BenqProjectorCommandException, BenqProjectorException {