def api_rule_check_wrapper(*args, **kwargs): call_args = None for r in rules: if not r.pre_check: continue if call_args is None: call_args = get_call_args(func, args, kwargs) r.verify(func.__name__, call_args) try: return func(*args, **kwargs) except RQInvalidArgument: raise except Exception as e: exc_info = sys.exc_info() t, v, tb = exc_info if call_args is None: call_args = get_call_args(func, args, kwargs, tb) try: for r in rules: if r.pre_check: continue r.verify(func.__name__, call_args) except RQInvalidArgument as e: six.reraise(RQInvalidArgument, e, tb) return if getattr(e, EXC_EXT_NAME, EXC_TYPE.NOTSET) == EXC_TYPE.NOTSET: patch_system_exc(e) raise
def api_rule_check_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except RQInvalidArgument: raise except Exception as e: exc_info = sys.exc_info() t, v, tb = exc_info try: call_args = inspect.getcallargs(unwrapper(func), *args, **kwargs) except TypeError as e: six.reraise(RQTypeError, RQTypeError(*e.args), tb) return try: for r in rules: r.verify(func.__name__, call_args[r.arg_name]) except RQInvalidArgument as e: six.reraise(RQInvalidArgument, e, tb) return if getattr(e, EXC_EXT_NAME, EXC_TYPE.NOTSET) == EXC_TYPE.NOTSET: patch_system_exc(e) raise
def api_rule_check_wrapper(*args, **kwargs): call_args = None for r in rules: if not r.pre_check: continue if call_args is None: call_args = get_call_args(func, args, kwargs) r.verify(func.__name__, call_args) try: return func(*args, **kwargs) except RQInvalidArgument: raise except Exception as e: exc_info = sys.exc_info() t, v, tb = exc_info if call_args is None: call_args = get_call_args(func, args, kwargs, tb) try: for r in rules: if r.pre_check: continue r.verify(func.__name__, call_args) except RQInvalidArgument as e: six.reraise(RQInvalidArgument, e, tb) return if getattr(e, EXC_EXT_NAME, EXC_TYPE.NOTSET) == EXC_TYPE.NOTSET: patch_system_exc(e) raise
def check(self, func, args, kwargs): call_args = None for r in self.pre_check_rules: if call_args is None: call_args = get_call_args(func, args, kwargs) r.verify(func.__name__, call_args) try: yield except RQInvalidArgument: raise except Exception as e: exc_info = sys.exc_info() t, v, tb = exc_info if call_args is None: call_args = get_call_args(func, args, kwargs, tb) try: for r in self.post_check_rules: r.verify(func.__name__, call_args) except RQInvalidArgument as e: six.reraise(RQInvalidArgument, e, tb) return if getattr(e, EXC_EXT_NAME, EXC_TYPE.NOTSET) == EXC_TYPE.NOTSET: patch_system_exc(e) raise
def api_rule_check_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except RQInvalidArgument: raise except Exception as e: exc_info = sys.exc_info() t, v, tb = exc_info try: call_args = inspect.getcallargs(unwrapper(func), *args, **kwargs) except TypeError as e: six.reraise(RQTypeError, RQTypeError(*e.args), tb) return try: for r in rules: r.verify(func.__name__, call_args[r.arg_name]) except RQInvalidArgument as e: six.reraise(RQInvalidArgument, e, tb) return if getattr(e, EXC_EXT_NAME, EXC_TYPE.NOTSET) == EXC_TYPE.NOTSET: patch_system_exc(e) raise
def deco(*args, **kwargs): try: return func(*args, **kwargs) except RQInvalidArgument: raise except Exception as e: if isinstance(e, TypeError): exc_info = sys.exc_info() try: ret = inspect.getcallargs(unwrapper(func), *args, **kwargs) except TypeError: t, v, tb = exc_info raise patch_user_exc(v.with_traceback(tb)) if getattr(e, EXC_EXT_NAME, EXC_TYPE.NOTSET) == EXC_TYPE.NOTSET: patch_system_exc(e) raise
def deco(*args, **kwargs): try: return func(*args, **kwargs) except RQInvalidArgument: raise except Exception as e: if isinstance(e, TypeError): exc_info = sys.exc_info() try: ret = inspect.getcallargs(unwrapper(func), *args, **kwargs) except TypeError: t, v, tb = exc_info raise patch_user_exc(v.with_traceback(tb)) if getattr(e, EXC_EXT_NAME, EXC_TYPE.NOTSET) == EXC_TYPE.NOTSET: patch_system_exc(e) raise