From 4d25dfd611e7786a17975fcaed039be971bac7da Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Mon, 10 Nov 2014 22:59:07 +0100 Subject: [PATCH] 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 Reviewed-by: Andrew Bartlett --- lib/ldb/pyldb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index efac7b1be65..40c802fd9af 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; }