shill: cellular: Hande failures when querying modem state via proxy.
BUG=chromium:244485
TEST=Build and run unit tests.
Change-Id: I70bd091fe54a91e0bd614da0ffcdc4442be58fb1
Reviewed-on: https://chromium-review.googlesource.com/168552
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/mm1_modem_proxy.cc b/mm1_modem_proxy.cc
index 9a1d293..be05d5f 100644
--- a/mm1_modem_proxy.cc
+++ b/mm1_modem_proxy.cc
@@ -4,6 +4,8 @@
#include "shill/mm1_modem_proxy.h"
+#include <ModemManager/ModemManager.h>
+
#include "shill/cellular_error.h"
#include "shill/logging.h"
@@ -342,13 +344,14 @@
}
}
-uint32_t ModemProxy::State() {
+uint32_t ModemProxy::State(Error *error) {
SLOG(DBus, 2) << __func__;
try {
return proxy_.State();
} catch (const DBus::Error &e) {
- LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
- return 0; // Make the compiler happy.
+ if (error)
+ CellularError::FromMM1DBusError(e, error);
+ return MM_MODEM_STATE_UNKNOWN;
}
}