def check(self, mark=<NUM_LIT:0>, err_msg="<STR_LIT>", **kwds):
unexpected_ret = kwds.get("<STR_LIT>", (<NUM_LIT:0>,))<EOL>def _check(fn):<EOL><INDENT>@wraps(fn)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>ret = fn(*args, **kwargs)<EOL>flags = reduce(<EOL>self._parser, [dict(num=mark, flags=[]), <NUM_LIT:2>, <NUM_LIT:1>])["<STR_LIT>"]<EOL>if <NUM_LIT:1> in flags:<EOL><INDENT>if self._has_error():<EOL><INDENT>raise AutoItError(err_msg)<EOL><DEDENT><DEDENT>if <NUM_LIT:2> in flags:<EOL><INDENT>if self._has_unexpected_ret(ret, unexpected_ret):<EOL><INDENT>raise AutoItError(err_msg)<EOL><DEDENT><DEDENT>return ret<EOL><DEDENT>return wrapper<EOL><DEDENT>return _check<EOL>
:param mark:
    0 - do not need check return value or error()
    1 - check error()
    2 - check return value