我有一个问题:
在烧瓶上测试时没有异常
通过gunicorn + gevent上线后,他们在以下代码中引发异常
-
try:
req_dict = request.args.to_dict()
req_desc = copy.copy(req_dict)
temp_card_pwd = str(req_desc['cardpwd'])
req_desc['cardpwd'] = temp_card_pwd.replace(temp_card_pwd[5:9], "****")
log.info('接收到一条请求信息(charge_in##) %s' % req_desc)
request_type = str(req_dict['command'])
charge_acct = str(req_dict['telephone'])
card_pwd = str(req_dict['cardpwd'])
res_dict = req_validate(request_type, card_pwd, charge_acct)
if res_dict['errcode'] == 0:
log.info('准备充值(charge_begin##)...%s '% req_desc)
time_start = time.time()
acct_charge = True
charge_res = charge(req_desc, card_pwd, charge_acct)
res_dict['body'] = charge_res
log.info('充值结果(charge_end##):请求:%s, 结果:%s 耗时:%s' % (req_desc, res_dict,
int((time.time() - time_start)*1000)))
else:
log.warning('返回异常请求结果(charge_out##):请求:%s 结果:%s' % (req_desc, res_dict))
except Exception as e:
if acct_charge:
code = 1007
msg = '充值异常!%s' % e
else:
code = 1006
msg = '传入参数错误! %s' % e
res_dict = {'errcode': code, 'msg': msg, 'body': None}
log.warning('返回异常请求结果(charge_exception##):请求参数异常!请核对后再发!%s' % res_dict)
例外是
2017-08-04 06:47:50,441 yidongserver.py[line:49] WARNING: [channel_name:yidongApp] 返回异常请求结果(charge_exception##):请求参数异常!请核对后再发!{'errcode': 1006, 'msg': '传入参数错误', 'body': None}
2017-08-04 06:47:50,445 yidongserver.py[line:25] INFO: [channel_name:yidongApp] 接收到一条请求信息(charge_in##) {'request_id': 'HF111708041450260032', 'card_id': '17356104229493840', 'telephone': '152***94608', 'cardpwd': '42381****349361850', 'money': '100', 'callbackurl': '', 'command': 'charge', 'channel_id': 'LTAppRY'}
虽然提出此例外,此充电请求仍然是SUCCESS负责,并返回ONCE
请帮助解决此警告异常!谢谢!