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

@ -185,9 +185,12 @@ def delete(id):
try:
material_name = ProductInboundService.delete_inbound(id)
return jsonify({"code": 200, "msg": "删除成功", "material_name": material_name})
except ValueError as ve:
return jsonify({"code": 400, "msg": str(ve)})
except Exception as e:
import traceback
traceback.print_exc()
return jsonify({"code": 500, "msg": str(e)}), 500
return jsonify({"code": 500, "msg": f"服务器内部错误详情: {str(e)}"}), 500
@inbound_product_bp.route('/<int:id>/history', methods=['GET'])
@permission_required('inbound_product')