Log invalid number when expecting numeric response from projector (#13549)

Signed-off-by: Michael Lobstein <michael.lobstein@gmail.com>
This commit is contained in:
mlobstein 2022-10-15 02:33:12 -05:00 committed by GitHub
parent c29c0b4c86
commit f5101b1764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View 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 {