summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@us.ibm.com>2015-12-02 11:10:36 -0500
committerBrad Bishop <bradleyb@us.ibm.com>2015-12-02 11:17:11 -0500
commitd457892a61a2dc45e9a9f68ffae7949b4976bd52 (patch)
tree9496ef7a6ff70537229331e42e7240768ed3ba65
parent34cae732597fb3d4b18a23b6494efdbfeca2033b (diff)
downloadphosphor-rest-server-d457892a61a2dc45e9a9f68ffae7949b4976bd52.tar.gz
phosphor-rest-server-d457892a61a2dc45e9a9f68ffae7949b4976bd52.zip
Handle type errors for method call parameters
Raise a 400 rather than internal server error for type errors.
-rw-r--r--obmc-rest3
1 files changed, 3 insertions, 0 deletions
diff --git a/obmc-rest b/obmc-rest
index c5ba8dc..74b5926 100644
--- a/obmc-rest
+++ b/obmc-rest
@@ -15,6 +15,7 @@ from OpenBMCMapper import Mapper, PathTree, IntrospectionNodeParser, ListMatch
DBUS_UNKNOWN_INTERFACE = 'org.freedesktop.UnknownInterface'
DBUS_UNKNOWN_METHOD = 'org.freedesktop.DBus.Error.UnknownMethod'
DBUS_INVALID_ARGS = 'org.freedesktop.DBus.Error.InvalidArgs'
+DBUS_TYPE_ERROR = 'org.freedesktop.DBus.Python.TypeError'
DELETE_IFACE = 'org.openbmc.Object.Delete'
_4034_msg = "The specified %s cannot be %s: '%s'"
@@ -216,6 +217,8 @@ class MethodHandler(RouteHandler):
except dbus.exceptions.DBusException, e:
if e.get_dbus_name() == DBUS_INVALID_ARGS:
abort(400, str(e))
+ if e.get_dbus_name() == DBUS_TYPE_ERROR:
+ abort(400, str(e))
raise
@staticmethod
OpenPOWER on IntegriCloud