def S500Handle(error): """ @attention: 500服务器警告异常 """ # msg,data = error.show() # return ucr.op_fail(msg='System Error!', data={}, status=500) return ucr.op_fail(msg='System Error!', data={}, status=500)
def S405Handle(error): """ @attention: 405服务器警告异常 """ # msg,data = error.show() return ucr.op_fail(msg='The method is not allowed for the requested URL!', data={}, status=405)
def BaseHandle(error): """ @attention: 未知异常 """ traceback.print_exc() error_msg = traceback.format_exc() url_data = "url(%s):%s" % (request.url, request.method) get_data = "get_data:%s" % dict(request.args) json_data = "json_data:%s" % request.bjson error_data = "error_msg:%s" % error_msg log_msg = "\n".join([url_data, get_data, json_data, error_data]) logger.warn(log_msg) msg = "System error" return ucr.op_fail(msg)
def S404Handle(error): """ @attention: 404服务器警告异常 """ # msg,data = error.show() return ucr.op_fail(msg='Resource Not Found Error!', data={}, status=404)
def ParamHandle(error): """ @attention: 带参数提示 """ msg, data = error.show() return ucr.op_fail(msg, data)
def NoAuthHandle(error): """ @attention: 提示 """ msg = error.show() return ucr.op_fail(msg, status=401)
def TipHandle(error): """ @attention: 提示 """ msg = error.show() return ucr.op_fail(msg)