shill: Propagate Cellular errors to the DBus caller.
BUG=chromium-os:19547
TEST=unit tests
Change-Id: Ieda54d89d977a48718302c6e1e1c7927e3cf2dba
Reviewed-on: http://gerrit.chromium.org/gerrit/6603
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/cellular.cc b/cellular.cc
index 44e25e0..20cf129 100644
--- a/cellular.cc
+++ b/cellular.cc
@@ -20,6 +20,7 @@
#include "shill/control_interface.h"
#include "shill/device.h"
#include "shill/device_info.h"
+#include "shill/error.h"
#include "shill/manager.h"
#include "shill/modem_simple_proxy_interface.h"
#include "shill/profile.h"
@@ -556,10 +557,13 @@
return type == Device::kCellular;
}
-void Cellular::Connect() {
+void Cellular::Connect(Error *error) {
VLOG(2) << __func__;
if (state_ == kStateConnected ||
state_ == kStateLinked) {
+ LOG(ERROR) << "Already connected; connection request ignored.";
+ CHECK(error);
+ error->Populate(Error::kAlreadyConnected);
return;
}
CHECK_EQ(kStateRegistered, state_);
@@ -567,6 +571,8 @@
if (!allow_roaming_ &&
service_->roaming_state() == flimflam::kRoamingStateRoaming) {
LOG(ERROR) << "Roaming disallowed; connection request ignored.";
+ CHECK(error);
+ error->Populate(Error::kNotOnHomeNetwork);
return;
}