From 21b6e9ec9ea08cc5e19a068d68331c178091caa6 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 24 May 2008 23:22:49 +0200 Subject: Add convenience function for creating objects with NDR error codes. (This used to be commit 991541a78c2428db89509081cc28072c9b542ffa) --- source4/pidl/lib/Parse/Pidl/Samba4/Python.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl') diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm index 5e76ff027b..26197365ee 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -241,7 +241,7 @@ sub PythonStruct($$$$$$) $self->pidl("err = ndr_push_struct_blob(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_push_flags_fn_t)ndr_push_$name);"); $self->pidl("if (err != NDR_ERR_SUCCESS) {"); $self->indent; - $self->pidl("PyErr_SetString(PyExc_RuntimeError, \"Unable to ndr pack\");"); + $self->pidl("PyErr_SetNdrError(err);"); $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); @@ -263,7 +263,7 @@ sub PythonStruct($$$$$$) $self->pidl("err = ndr_pull_struct_blob_all(&blob, py_talloc_get_mem_ctx(py_obj), NULL, object, (ndr_pull_flags_fn_t)ndr_pull_$name);"); $self->pidl("if (err != NDR_ERR_SUCCESS) {"); $self->indent; - $self->pidl("PyErr_SetString(PyExc_RuntimeError, \"Unable to ndr unpack\");"); + $self->pidl("PyErr_SetNdrError(err);"); $self->pidl("return NULL;"); $self->deindent; $self->pidl("}"); -- cgit