From f05edc0ecb9da2cb00a83b38d0be5812cc4ccf77 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Mon, 2 Jan 2012 19:25:56 -0800 Subject: pyldb: raise an exception if we can't add the attribute --- lib/ldb/pyldb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/ldb') diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index b2315e6751..b253bcd28e 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -2668,12 +2668,17 @@ static int py_ldb_msg_setitem(PyLdbMessageObject *self, PyObject *name, PyObject /* delitem */ ldb_msg_remove_attr(self->msg, attr_name); } else { + int ret; struct ldb_message_element *el = PyObject_AsMessageElement(self->msg, value, 0, attr_name); if (el == NULL) return -1; ldb_msg_remove_attr(pyldb_Message_AsMessage(self), attr_name); - ldb_msg_add(pyldb_Message_AsMessage(self), el, el->flags); + ret = ldb_msg_add(pyldb_Message_AsMessage(self), el, el->flags); + if (ret != LDB_SUCCESS) { + PyErr_SetLdbError(PyExc_LdbError, ret, NULL); + return -1; + } } return 0; } -- cgit