shill: Wrap calls to dbus proxies in try-catch blocks
Many functions of the dbus-c++ library throw exceptions. These
functions are called by proxies in shill. Calls to dbus-c++
functions should be wrapped in try-catch blocks so that they
can handle the exception or at least log a meaningful error.
BUG=chromium-os:30566
TEST=Ran unit tests.
Change-Id: I6063812782f1b1662c6775c140c7f26480ea5fc8
Reviewed-on: https://gerrit.chromium.org/gerrit/21904
Commit-Ready: Gary Morain <gmorain@chromium.org>
Reviewed-by: Gary Morain <gmorain@chromium.org>
Tested-by: Gary Morain <gmorain@chromium.org>
Reviewed-by: Jason Glasgow <jglasgow@chromium.org>
diff --git a/modem_cdma_proxy.cc b/modem_cdma_proxy.cc
index edda190..4395eb0 100644
--- a/modem_cdma_proxy.cc
+++ b/modem_cdma_proxy.cc
@@ -69,7 +69,12 @@
const string ModemCDMAProxy::MEID() {
LOG(INFO) << "ModemCDMAProxy::" << __func__;
SLOG(DBus, 2) << __func__;
- return proxy_.Meid();
+ try {
+ return proxy_.Meid();
+ } catch (const DBus::Error &e) {
+ LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
+ return string(); // Make the compiler happy.
+ }
}
void ModemCDMAProxy::set_activation_state_callback(