From e3482ffeed80c156ce3832609515e3aea4ba907f Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 2 Jun 2006 14:33:57 +0000 Subject: r16007: If no error string was setup by the backend, ensure that we always get at least a generic error, even when inside a transaction. This helps debugging ldb/js interactions a lot... Andrew Bartlett (This used to be commit b607acf6f0b3567a40a3e35911c690feda243f50) --- source4/lib/ldb/common/ldb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source4/lib/ldb/common/ldb.c') diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 53b4e51ff3..126ad37d9b 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -265,7 +265,8 @@ static int ldb_op_finish(struct ldb_context *ldb, int status) if (ldb->err_string == NULL) { /* no error string was setup by the backend */ ldb_set_errstring(ldb, - talloc_asprintf(ldb, "ldb error %d", status)); + talloc_asprintf(ldb, "%s (%d)", + ldb_strerror(status), status)); } ldb_transaction_cancel(ldb); return status; @@ -463,6 +464,13 @@ static int ldb_autotransaction_request(struct ldb_context *ldb, struct ldb_reque return ldb_op_finish(ldb, ret); } + if (ldb->err_string == NULL) { + /* no error string was setup by the backend */ + ldb_set_errstring(ldb, + talloc_asprintf(ldb, "%s (%d)", + ldb_strerror(ret), ret)); + } + return ret; } -- cgit