git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d14c860
)
Add convenience macro for raising exceptions for NTSTATUS / WERROR.
author
Jelmer Vernooij
<jelmer@samba.org>
Thu, 18 Dec 2008 15:32:58 +0000
(15:32 +0000)
committer
Jelmer Vernooij
<jelmer@samba.org>
Thu, 18 Dec 2008 15:32:58 +0000
(15:32 +0000)
source4/libcli/util/pyerrors.h
patch
|
blob
|
history
diff --git
a/source4/libcli/util/pyerrors.h
b/source4/libcli/util/pyerrors.h
index 47e6f58b5db781d81f17f207671d229052e577d0..66823f4a41cba9a6f7637828ecddefe94a92c80c 100644
(file)
--- a/
source4/libcli/util/pyerrors.h
+++ b/
source4/libcli/util/pyerrors.h
@@
-30,4
+30,16
@@
#define PyErr_SetNTSTATUS(status) \
PyErr_SetObject(PyExc_RuntimeError, PyErr_FromNTSTATUS(status))
+#define PyErr_NTSTATUS_IS_ERR_RAISE(status) \
+ if (NT_STATUS_IS_ERR(status)) { \
+ PyErr_SetNTSTATUS(status); \
+ return NULL; \
+ }
+
+#define PyErr_WERROR_IS_ERR_RAISE(status) \
+ if (!W_ERROR_IS_OK(status)) { \
+ PyErr_SetWERROR(status); \
+ return NULL; \
+ }
+
#endif /* __PYERRORS_H__ */