Merge pull request #4 from bradbishop/enumerate
Make MapperNotFound a proper dbus exception
diff --git a/OpenBMCMapper.py b/OpenBMCMapper.py
index 1233c70..2ed65f7 100644
--- a/OpenBMCMapper.py
+++ b/OpenBMCMapper.py
@@ -23,10 +23,7 @@
MAPPER_IFACE = MAPPER_NAME + '.ObjectMapper'
MAPPER_PATH = '/org/openbmc/objectmapper/objectmapper'
ENUMERATE_IFACE = 'org.openbmc.Object.Enumerate'
-
-class MapperNotFoundException(Exception):
- def __init__(self, msg):
- super(MapperNotFoundException, self).__init__(msg)
+MAPPER_NOT_FOUND = 'org.openbmc.objectmapper.Error.NotFound'
class Path:
def __init__(self, path):
diff --git a/phosphor-mapper b/phosphor-mapper
index 36bf09b..011dc56 100644
--- a/phosphor-mapper
+++ b/phosphor-mapper
@@ -16,14 +16,20 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.
-import sys
import dbus
import dbus.service
+import dbus.exceptions
import dbus.mainloop.glib
import gobject
-from OpenBMCMapper import Path, IntrospectionParser, PathTree
+from OpenBMCMapper import IntrospectionParser, PathTree
import OpenBMCMapper
+class MapperNotFoundException(dbus.exceptions.DBusException):
+ _dbus_error_name = OpenBMCMapper.MAPPER_NOT_FOUND
+ def __init__(self, path):
+ super(MapperNotFoundException, self).__init__(
+ "path or object not found: %s" %(path))
+
class ObjectMapper(dbus.service.Object):
def __init__(self, bus, path,
name_match = OpenBMCMapper.org_dot_openbmc_match,