summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2014-11-10 22:59:07 +0100
committerAndrew Bartlett <abartlet@samba.org>2014-11-25 05:04:07 +0100
commit4d25dfd611e7786a17975fcaed039be971bac7da (patch)
tree93ff52102c48134f18290c2f1c7a383e9e469813
parent18f879b857c174371a9fe27722c70051ed68ed64 (diff)
lib-pyldb: Throw exception when we can't create MessageElement object
At the moment we return an error, but no exception and it is hard to instantly see what the problem is from Python Signed-off-by: Kamen Mazdrashki <kamenim@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--lib/ldb/pyldb.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index efac7b1be6..40c802fd9a 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -2352,6 +2352,8 @@ static struct ldb_message_element *PyObject_AsMessageElement(
(uint8_t *)PyString_AsString(obj), me->values[i].length+1);
}
} else {
+ PyErr_Format(PyExc_TypeError,
+ "String or List type expected for '%s' attribute", attr_name);
talloc_free(me);
me = NULL;
}