shill: cellular: Properly translate errors from ModemManager.

The existing code that handled mapping some ModemManager errors to shill
API errors did not conform to the ModemManager1 API. This CL adds a new
static method to CellularError to handle ModemManager1 errors
separately.

BUG=chromium:248835
TEST=1. Build and run unit tests.
     2. Start the pseudomodem in locked mode (after stopping
        ModemManager and cromo).
     3. Use dbus-send or python to interact with the shill Device API
        directly. Use methods such as EnterPin with incorrect values and
        verify that the D-Bus error returned by shill are meaningful
        (e.g. entering an incorrect pin should return an error with the
        name 'org.chromium.flimflam.Error.IncorrectPin').

Change-Id: I0672595cf1db39491e7c946a3527ced80cff8ceb
Reviewed-on: https://gerrit.chromium.org/gerrit/60796
Reviewed-by: Thieu Le <thieule@chromium.org>
Commit-Queue: Arman Uguray <armansito@chromium.org>
Tested-by: Arman Uguray <armansito@chromium.org>
diff --git a/Makefile b/Makefile
index aa160c3..2e5cd21 100644
--- a/Makefile
+++ b/Makefile
@@ -553,6 +553,7 @@
 	cellular_capability_universal.o \
 	cellular_capability_universal_cdma.o \
 	cellular_error.o \
+	cellular_error_mm1.o \
 	cellular_operator_info.o \
 	cellular_service.o \
 	dbus_objectmanager_proxy.o \
@@ -584,6 +585,7 @@
 	cellular_capability_gsm_unittest.o \
 	cellular_capability_universal_cdma_unittest.o \
 	cellular_capability_universal_unittest.o \
+	cellular_error_unittest.o \
 	cellular_operator_info_unittest.o \
 	cellular_service_unittest.o \
 	cellular_unittest.o \
diff --git a/cellular_error.cc b/cellular_error.cc
index fe0f5ef..5937ff9 100644
--- a/cellular_error.cc
+++ b/cellular_error.cc
@@ -26,7 +26,7 @@
 
 // static
 void CellularError::FromDBusError(const DBus::Error &dbus_error,
-                                   Error *error) {
+                                  Error *error) {
   if (!error)
     return;
 
diff --git a/cellular_error.h b/cellular_error.h
index 5db343c..03fc388 100644
--- a/cellular_error.h
+++ b/cellular_error.h
@@ -15,6 +15,8 @@
  public:
   static void FromDBusError(const DBus::Error &dbus_error, Error *error);
 
+  static void FromMM1DBusError(const DBus::Error &dbus_error, Error *error);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(CellularError);
 };
diff --git a/cellular_error_mm1.cc b/cellular_error_mm1.cc
new file mode 100644
index 0000000..da5e7b0
--- /dev/null
+++ b/cellular_error_mm1.cc
@@ -0,0 +1,62 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/cellular_error.h"
+
+#include <string>
+
+#include <ModemManager/ModemManager.h>
+
+// TODO(armansito): Once we refactor the code to handle the ModemManager D-Bus
+// bindings in a dedicated class, this code should move there.
+// (See crbug.com/246425)
+
+using std::string;
+
+namespace shill {
+
+namespace {
+
+const char *kErrorIncorrectPassword =
+    MM_DBUS_INTERFACE ".MobileEquipment.IncorrectPassword";
+
+const char *kErrorSimPuk =
+    MM_DBUS_INTERFACE ".MobileEquipment.SimPuk";
+
+const char *kErrorSimPin =
+    MM_DBUS_INTERFACE ".MobileEquipment.SimPin";
+
+}  // namespace
+
+// static
+void CellularError::FromMM1DBusError(const DBus::Error &dbus_error,
+                                     Error *error) {
+  if (!error)
+    return;
+
+  if (!dbus_error.is_set()) {
+    error->Reset();
+    return;
+  }
+
+  string name(dbus_error.name());
+  const char *msg = dbus_error.message();
+  Error::Type type;
+
+  if (name == kErrorIncorrectPassword)
+    type = Error::kIncorrectPin;
+  else if (name == kErrorSimPin)
+    type = Error::kPinRequired;
+  else if (name == kErrorSimPuk)
+    type = Error::kPinBlocked;
+  else
+    type = Error::kOperationFailed;
+
+  if (msg)
+    return error->Populate(type, msg);
+  else
+    return error->Populate(type);
+}
+
+}  // namespace shill
diff --git a/cellular_error_unittest.cc b/cellular_error_unittest.cc
new file mode 100644
index 0000000..6d63bbc
--- /dev/null
+++ b/cellular_error_unittest.cc
@@ -0,0 +1,123 @@
+// Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "shill/cellular_error.h"
+
+#include <dbus-c++/error.h>
+#include <gtest/gtest.h>
+
+namespace shill {
+
+class CellularErrorTest : public testing::Test {
+};
+
+namespace {
+
+const char kErrorIncorrectPasswordMM[] =
+    "org.freedesktop.ModemManager.Modem.Gsm.IncorrectPassword";
+
+const char kErrorSimPinRequiredMM[] =
+    "org.freedesktop.ModemManager.Modem.Gsm.SimPinRequired";
+
+const char kErrorSimPukRequiredMM[] =
+    "org.freedesktop.ModemManager.Modem.Gsm.SimPukRequired";
+
+const char kErrorGprsNotSubscribedMM[] =
+    "org.freedesktop.ModemManager.Modem.Gsm.GprsNotSubscribed";
+
+const char kErrorIncorrectPasswordMM1[] =
+    "org.freedesktop.ModemManager1.MobileEquipment.IncorrectPassword";
+
+const char kErrorSimPinMM1[] =
+    "org.freedesktop.ModemManager1.MobileEquipment.SimPin";
+
+const char kErrorSimPukMM1[] =
+    "org.freedesktop.ModemManager1.MobileEquipment.SimPuk";
+
+const char kErrorMessage[] = "Some error message.";
+
+}  // namespace
+
+TEST_F(CellularErrorTest, FromDBusError) {
+  Error shill_error;
+
+  CellularError::FromDBusError(DBus::Error(), NULL);
+  EXPECT_TRUE(shill_error.IsSuccess());
+
+  CellularError::FromDBusError(DBus::Error(), &shill_error);
+  EXPECT_TRUE(shill_error.IsSuccess());
+
+  CellularError::FromDBusError(
+      DBus::Error(kErrorIncorrectPasswordMM, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kIncorrectPin, shill_error.type());
+
+  CellularError::FromDBusError(
+      DBus::Error(kErrorSimPinRequiredMM, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kPinRequired, shill_error.type());
+
+  CellularError::FromDBusError(
+      DBus::Error(kErrorSimPukRequiredMM, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kPinBlocked, shill_error.type());
+
+  CellularError::FromDBusError(
+      DBus::Error(kErrorGprsNotSubscribedMM, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kInvalidApn, shill_error.type());
+
+  CellularError::FromDBusError(
+      DBus::Error(kErrorIncorrectPasswordMM1, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kOperationFailed, shill_error.type());
+
+  CellularError::FromDBusError(
+      DBus::Error("Some random error name.", kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kOperationFailed, shill_error.type());
+}
+
+TEST_F(CellularErrorTest, FromMM1DBusError) {
+  Error shill_error;
+
+  CellularError::FromDBusError(DBus::Error(), NULL);
+  EXPECT_TRUE(shill_error.IsSuccess());
+
+  CellularError::FromMM1DBusError(DBus::Error(), &shill_error);
+  EXPECT_TRUE(shill_error.IsSuccess());
+
+  CellularError::FromMM1DBusError(
+      DBus::Error(kErrorIncorrectPasswordMM1, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kIncorrectPin, shill_error.type());
+
+  CellularError::FromMM1DBusError(
+      DBus::Error(kErrorSimPinMM1, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kPinRequired, shill_error.type());
+
+  CellularError::FromMM1DBusError(
+      DBus::Error(kErrorSimPukMM1, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kPinBlocked, shill_error.type());
+
+  CellularError::FromMM1DBusError(
+      DBus::Error(kErrorGprsNotSubscribedMM, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kOperationFailed, shill_error.type());
+
+  CellularError::FromMM1DBusError(
+      DBus::Error(kErrorIncorrectPasswordMM, kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kOperationFailed, shill_error.type());
+
+  CellularError::FromMM1DBusError(
+      DBus::Error("Some random error name.", kErrorMessage),
+      &shill_error);
+  EXPECT_EQ(Error::kOperationFailed, shill_error.type());
+}
+
+}  // namespace shill
+
diff --git a/mm1_bearer_proxy.cc b/mm1_bearer_proxy.cc
index a43a116..cb35156 100644
--- a/mm1_bearer_proxy.cc
+++ b/mm1_bearer_proxy.cc
@@ -32,7 +32,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -47,7 +47,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -137,7 +137,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -146,7 +146,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
diff --git a/mm1_modem_location_proxy.cc b/mm1_modem_location_proxy.cc
index dd4cc29..0f37bef 100644
--- a/mm1_modem_location_proxy.cc
+++ b/mm1_modem_location_proxy.cc
@@ -32,7 +32,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -48,7 +48,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -106,7 +106,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -118,7 +118,7 @@
   scoped_ptr<DBusEnumValueMapCallback> callback(
       reinterpret_cast<DBusEnumValueMapCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(location, error);
 }
 
diff --git a/mm1_modem_modem3gpp_proxy.cc b/mm1_modem_modem3gpp_proxy.cc
index ef97a06..7f89167 100644
--- a/mm1_modem_modem3gpp_proxy.cc
+++ b/mm1_modem_modem3gpp_proxy.cc
@@ -31,7 +31,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -46,7 +46,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -112,7 +112,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -123,7 +123,7 @@
   scoped_ptr<DBusPropertyMapsCallback> callback(
       reinterpret_cast<DBusPropertyMapsCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(results, error);
 }
 
diff --git a/mm1_modem_modemcdma_proxy.cc b/mm1_modem_modemcdma_proxy.cc
index 94bb1d6..74367e8 100644
--- a/mm1_modem_modemcdma_proxy.cc
+++ b/mm1_modem_modemcdma_proxy.cc
@@ -30,7 +30,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -46,7 +46,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -151,7 +151,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -161,7 +161,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
diff --git a/mm1_modem_proxy.cc b/mm1_modem_proxy.cc
index 2e29a45..9a1d293 100644
--- a/mm1_modem_proxy.cc
+++ b/mm1_modem_proxy.cc
@@ -36,7 +36,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -50,7 +50,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -66,7 +66,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -81,7 +81,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -95,7 +95,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -110,7 +110,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -125,7 +125,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -141,7 +141,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -156,7 +156,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -172,7 +172,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -187,7 +187,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -472,7 +472,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -484,7 +484,7 @@
   scoped_ptr<DBusPathsCallback> callback(
       reinterpret_cast<DBusPathsCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(bearers, error);
 }
 
@@ -494,7 +494,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -503,7 +503,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -512,7 +512,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -521,7 +521,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -531,7 +531,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -540,7 +540,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -549,7 +549,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -559,7 +559,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -568,7 +568,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
diff --git a/mm1_modem_simple_proxy.cc b/mm1_modem_simple_proxy.cc
index 4ef2bbd..4e4d781 100644
--- a/mm1_modem_simple_proxy.cc
+++ b/mm1_modem_simple_proxy.cc
@@ -31,7 +31,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -46,7 +46,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -60,7 +60,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -82,7 +82,7 @@
   scoped_ptr<DBusPathCallback> callback(
       reinterpret_cast<DBusPathCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(bearer, error);
 }
 
@@ -91,7 +91,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -103,7 +103,7 @@
   scoped_ptr<DBusPropertyMapCallback> callback(
       reinterpret_cast<DBusPropertyMapCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(properties, error);
 }
 
diff --git a/mm1_modem_time_proxy.cc b/mm1_modem_time_proxy.cc
index d659257..72694a5 100644
--- a/mm1_modem_time_proxy.cc
+++ b/mm1_modem_time_proxy.cc
@@ -35,7 +35,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -76,7 +76,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<StringCallback> callback(reinterpret_cast<StringCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(time, error);
 }
 
diff --git a/mm1_sim_proxy.cc b/mm1_sim_proxy.cc
index 45d9a53..b88b991 100644
--- a/mm1_sim_proxy.cc
+++ b/mm1_sim_proxy.cc
@@ -33,7 +33,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -51,7 +51,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -69,7 +69,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -87,7 +87,7 @@
     cb.release();
   } catch (const DBus::Error &e) {
     if (error)
-      CellularError::FromDBusError(e, error);
+      CellularError::FromMM1DBusError(e, error);
   }
 }
 
@@ -147,7 +147,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -156,7 +156,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -165,7 +165,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }
 
@@ -174,7 +174,7 @@
   SLOG(DBus, 2) << __func__;
   scoped_ptr<ResultCallback> callback(reinterpret_cast<ResultCallback *>(data));
   Error error;
-  CellularError::FromDBusError(dberror, &error);
+  CellularError::FromMM1DBusError(dberror, &error);
   callback->Run(error);
 }