mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
pyerrors: Add PyErr_Set{WERROR,HRESULT,NTSTATUS}_and_string()
This varient allows control of the text explaination string Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12398 (cherry picked from commit e737171f6ef172de559b41d54989eca0d7663b4e)
This commit is contained in:
parent
7396b5efdd
commit
31d24bfb2a
@ -43,6 +43,21 @@
|
||||
"NTSTATUSError"), \
|
||||
PyErr_FromNTSTATUS(status))
|
||||
|
||||
#define PyErr_SetWERROR_and_string(werr, string) \
|
||||
PyErr_SetObject(PyObject_GetAttrString(PyImport_ImportModule("samba"),\
|
||||
"WERRORError"), \
|
||||
Py_BuildValue("(i,s)", W_ERROR_V(werr), string))
|
||||
|
||||
#define PyErr_SetHRESULT_and_string(hresult, string) \
|
||||
PyErr_SetObject(PyObject_GetAttrString(PyImport_ImportModule("samba"),\
|
||||
"HRESULTError"), \
|
||||
Py_BuildValue("(i,s)", HRES_ERROR_V(hresult), string))
|
||||
|
||||
#define PyErr_SetNTSTATUS_and_string(status, string) \
|
||||
PyErr_SetObject(PyObject_GetAttrString(PyImport_ImportModule("samba"),\
|
||||
"NTSTATUSError"), \
|
||||
Py_BuildValue("(i,s)", NT_STATUS_V(status), string))
|
||||
|
||||
#define PyErr_NTSTATUS_IS_ERR_RAISE(status) \
|
||||
if (NT_STATUS_IS_ERR(status)) { \
|
||||
PyErr_SetNTSTATUS(status); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user