diff options
author | Tim Potter <tpot@samba.org> | 2005-06-04 01:06:30 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:17:32 -0500 |
commit | 384ad5c71b012d11e61d5a9ad8059423f771cccb (patch) | |
tree | 0724b3cf2435f5963c86d06a1b4dc43a7283f6dd /source4/scripting/ejs | |
parent | 6bf9b5cd9a3f1224c64981948c52339e2dd4b6ab (diff) | |
download | samba-384ad5c71b012d11e61d5a9ad8059423f771cccb.tar.gz samba-384ad5c71b012d11e61d5a9ad8059423f771cccb.tar.bz2 samba-384ad5c71b012d11e61d5a9ad8059423f771cccb.zip |
r7254: Add a mprWERROR() function with the same attributes as mprNTSTATUS.
(This used to be commit 2fa6f7bb2b8390f6486f6531212b556e98a6c528)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r-- | source4/scripting/ejs/mprutil.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c index 4aee7d1c50..2a1036d9a4 100644 --- a/source4/scripting/ejs/mprutil.c +++ b/source4/scripting/ejs/mprutil.c @@ -189,3 +189,27 @@ struct MprVar mprNTSTATUS(NTSTATUS status) return res; } + +/* + turn a WERROR into a MprVar object with lots of funky properties +*/ +struct MprVar mprWERROR(WERROR status) +{ + struct MprVar res, val; + + res = mprCreateObjVar("werror", MPR_DEFAULT_HASH_SIZE); + + val = mprCreateStringVar(win_errstr(status), 1); + mprCreateProperty(&res, "errstr", &val); + + val = mprCreateIntegerVar(W_ERROR_V(status)); + mprCreateProperty(&res, "v", &val); + + val = mprCreateBoolVar(W_ERROR_IS_OK(status)); + mprCreateProperty(&res, "is_ok", &val); + + val = mprCreateBoolVar(True); + mprCreateProperty(&res, "is_err", &val); + + return res; +} |