def abort(http_status_code, **kwargs): """Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. """ #noinspection PyUnresolvedReferences try: original_flask_abort(http_status_code) except HTTPException as e: e.data = kwargs raise e
def abort(http_status_code, **kwargs): """Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. """ #noinspection PyUnresolvedReferences try: original_flask_abort(http_status_code) except HTTPException as e: if len(kwargs): e.data = kwargs raise
def abort(http_status_code, *args, **kwargs): """ Rest style flask abort wrapper """ try: original_flask_abort(http_status_code) except HTTPException as e: e.data = kwargs if len(args): e.data['_errors'] = args raise
def abort(cls, http_status_code, **kwargs): """Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. 用于覆盖原flask-restful中的abort,从而实现自定义参数验证错误信息。 """ try: original_flask_abort(http_status_code) except HTTPException as e: if len(kwargs): e.data = cls._make_parameter_error_response( http_status_code=e.code, data=kwargs) raise
def abort(http_status_code, **kwargs): """Raise a HTTPException for the given http_status_code. Attach any keyword arguments to the exception for later processing. """ # noinspection PyUnresolvedReferences try: hint = kwargs.get('message') if isinstance(hint, dict): msg = ','.join(hint.values()) original_flask_abort(send(http_status_code, data=hint, msg=msg)) else: original_flask_abort(send(http_status_code, data=hint)) except HTTPException as e: if len(kwargs): e.data = kwargs raise