Commit 68b2e985 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Make validation error message more useful


Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 9bc5ac44
......@@ -468,8 +468,9 @@ class BaseOpCode(objectutils.ValidatedSlots):
if set_defaults or hasattr(self, attr_name):
attr_val = getattr(self, attr_name)
if not test(attr_val):
logging.error("OpCode %s, parameter %s, has invalid type %s/value %s",
self.OP_ID, attr_name, type(attr_val), attr_val)
logging.error("OpCode %s, parameter %s, has invalid type %s/value %s"
" expecting type %s",
self.OP_ID, attr_name, type(attr_val), attr_val, test)
raise errors.OpPrereqError("Parameter '%s.%s' fails validation" %
(self.OP_ID, attr_name),
errors.ECODE_INVAL)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment