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_gsm_network_proxy.cc b/modem_gsm_network_proxy.cc
index a11a563..37f67ba 100644
--- a/modem_gsm_network_proxy.cc
+++ b/modem_gsm_network_proxy.cc
@@ -85,7 +85,12 @@
uint32 ModemGSMNetworkProxy::AccessTechnology() {
SLOG(DBus, 2) << __func__;
+ try {
return proxy_.AccessTechnology();
+ } catch (const DBus::Error &e) {
+ LOG(FATAL) << "DBus exception: " << e.name() << ": " << e.what();
+ return 0; // Make the compiler happy.
+ }
}
void ModemGSMNetworkProxy::set_signal_quality_callback(