-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[ecovacs] Catch more exceptions when parsing vacuum data #20016
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -38,7 +38,6 @@ | |||||
| import org.openhab.binding.ecovacs.internal.api.impl.dto.response.portal.PortalLoginResponse; | ||||||
| import org.openhab.binding.ecovacs.internal.api.model.CleanLogRecord; | ||||||
| import org.openhab.binding.ecovacs.internal.api.model.DeviceCapability; | ||||||
| import org.openhab.binding.ecovacs.internal.api.util.DataParsingException; | ||||||
| import org.openhab.core.io.net.http.TrustAllTrustManager; | ||||||
| import org.slf4j.Logger; | ||||||
| import org.slf4j.LoggerFactory; | ||||||
|
|
@@ -179,7 +178,7 @@ public void connect(final EventListener listener, ScheduledExecutorService sched | |||||
| String eventName = receivedTopic.split("/")[2].toLowerCase(); | ||||||
| logger.trace("{}: Got MQTT message on topic {}: {}", getSerialNumber(), receivedTopic, payload); | ||||||
| parser.handleMessage(eventName, payload); | ||||||
| } catch (DataParsingException e) { | ||||||
| } catch (Exception e) { | ||||||
|
||||||
| } catch (Exception e) { | |
| } catch (RuntimeException e) { |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -147,7 +147,7 @@ public <T> T sendCommand(IotDeviceCommand<T> command) throws EcovacsApiException | |||||
| return command.convertResponse(responseObj, ProtocolVersion.XML, gson); | ||||||
| } | ||||||
| } | ||||||
| } catch (DataParsingException | ParserConfigurationException | TransformerException e) { | ||||||
| } catch (Exception e) { | ||||||
|
||||||
| } catch (Exception e) { | |
| } catch (RuntimeException e) { |
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.
Catching generic
Exceptionis overly broad and may mask unexpected errors that shouldn't be recoverable (like OutOfMemoryError or other serious JVM errors). Consider catchingRuntimeExceptioninstead, or at minimum catching specific exceptions likeNullPointerException,IllegalStateException, and keeping the existing specific exceptions. This allows truly exceptional errors to propagate properly while still catching the parsing and data-related runtime exceptions mentioned in the PR description.