fix(api): expose real 500 error stack trace and fix missing func import

This commit is contained in:
DXC
2026-03-25 10:56:31 +08:00
parent ac7774e0e3
commit 7421ef3231
6 changed files with 20 additions and 3 deletions

View File

@ -313,7 +313,9 @@ def delete_buy(id):
# 捕获业务拦截的报错,返回友好的 msg
return jsonify({"code": 400, "msg": str(ve)})
except Exception as e:
return jsonify({"code": 500, "msg": "服务器内部错误,请联系系统管理员"}), 500
import traceback
traceback.print_exc() # 在控制台打印真实错误堆栈
return jsonify({"code": 500, "msg": f"服务器内部错误详情: {str(e)}"}), 500
# ------------------------------------------------------------------