def oni_call(func):
@functools.wraps(func)
def wrapper(*args):
res = func(*args)
if res != OniStatus.ONI_STATUS_OK:
msg = oniGetExtendedError()
if not msg:
msg = ''
buf = ctypes.create_string_buffer(1024)
rc = _oniGetLogFileName(buf, ctypes.sizeof(buf))
if rc == OniStatus.ONI_STATUS_OK:
logfile = buf.value
else:
logfile = None
raise OpenNIError(res, msg.strip(), logfile)
return res
return wrapper
评论列表
文章目录