Commit 46c673b5 by liimin

fix: 添加Sentry错误上报以捕获订单相关异常

在订单列表、详情、物流查询、售后详情等关键操作中添加Sentry错误上报
统一处理HTTP请求失败时的错误上报
修复快递信息组件中的参数校验逻辑并添加错误上报
1 parent f864ef11
......@@ -105,16 +105,18 @@ class Request {
title: message || '系统异常',
icon: 'none'
})
wx.p.sentry.reportError(`接口异常:${message}`, {code,message,params})
}
}
},
fail(error) {
wx.hideLoading()
console.error(`接口异常:`, error)
wx.showToast({
title: typeof error == 'string' ? error : JSON.stringify(error) || '系统异常',
icon: 'error'
})
console.error(`接口异常:`, error)
wx.p.sentry.reportError(`接口异常:${error.message}`, {error,params})
reject(error)
},
complete() {
......
......@@ -71,6 +71,8 @@ Page({
status,
button,
});
}).catch((err) => {
wx.p.sentry.reportError(`售后详情异常:${err.message}`, {...this.data,err});
})
.finally(() => {
wx.hideLoading();
......@@ -123,10 +125,13 @@ Page({
tab: ORDER_STATUS[OrderStatusEnum.COMPLETED],
});
}
}).catch((err) => {
wx.p.sentry.reportError(`撤销售后:${err.message}`, {...this.data.orderInfo,err});
});
}
})
.catch(() => {
.catch((err) => {
wx.p.sentry.reportError(`撤销售后Modal:${err.message}`, {...this.data.orderInfo,err});
wx.p.wxApi.showToast("已取消");
})
.finally(() => {
......
......@@ -152,6 +152,7 @@ Component({
*/
processExpressInfo(expressInfo) {
if (!expressInfo || typeof expressInfo !== "object") {
wx.p.sentry.reportError(`快递信息异常:expressInfo参数无效`, {expressInfo});
console.warn("Express组件: expressInfo参数无效");
return;
}
......@@ -160,6 +161,7 @@ Component({
// 验证必要字段
if (typeof logisticsStatus !== "number") {
wx.p.sentry.reportError(`快递信息异常:logisticsStatus字段无效`, {expressInfo});
console.warn("Express组件: logisticsStatus字段无效");
return;
}
......
......@@ -37,6 +37,8 @@ Page({
this.setData({
expressInfo: data,
});
}).catch((err) => {
wx.p.sentry.reportError(`查询物流异常:${err.message}`, {subOrderCode,err});
});
},
getOrderDetail(subOrderCode) {
......@@ -68,6 +70,8 @@ Page({
},
});
}
}).catch((err) => {
wx.p.sentry.reportError(`订单详情异常:${err.message}`, {subOrderCode,err});
})
.finally(() => {
wx.hideLoading();
......
......@@ -175,6 +175,8 @@ Page({
list,
listFlag: true,
});
}).catch((err) => {
wx.p.sentry.reportError(`订单列表异常:${err.message}`, {...obj,err});
})
.finally(() => {
wx.hideLoading();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!