fix(mp): 空 catch 块添加 console.warn 日志(82 处)
55 个文件中 82 处空 catch 块添加模块前缀日志输出: - stores: auth/health/points (7 处) - services: request/ai-chat/health/ble/* (10 处) - hooks: useLongPolling/usePagination (3 处) - pages: 核心+子包共 35 个页面 (62 处) 保留静默的 catch: secure-storage fallback、Storage 恢复、 analytics 防洪、BLE 断连清理、用户拒绝订阅等合理忽略场景
This commit is contained in:
@@ -39,7 +39,8 @@ export default function AlertDetail() {
|
||||
try {
|
||||
const data = await getAlert(alertId);
|
||||
setAlert(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -55,7 +56,8 @@ export default function AlertDetail() {
|
||||
const updated = await acknowledgeAlert(alert.id, alert.version);
|
||||
setAlert(updated);
|
||||
Taro.showToast({ title: '已确认', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
@@ -69,7 +71,8 @@ export default function AlertDetail() {
|
||||
const updated = await dismissAlert(alert.id, alert.version);
|
||||
setAlert(updated);
|
||||
Taro.showToast({ title: '已忽略', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
@@ -83,7 +86,8 @@ export default function AlertDetail() {
|
||||
const updated = await resolveAlert(alert.id, alert.version);
|
||||
setAlert(updated);
|
||||
Taro.showToast({ title: '已恢复', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setActionLoading(false);
|
||||
|
||||
@@ -71,7 +71,8 @@ export default function AlertList() {
|
||||
});
|
||||
setAlerts(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-alert] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
|
||||
@@ -113,7 +113,8 @@ export default function DialysisCreate() {
|
||||
ultrafiltration_volume: r.ultrafiltration_volume != null ? String(r.ultrafiltration_volume) : '',
|
||||
complication_notes: r.complication_notes || '',
|
||||
});
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -167,7 +168,8 @@ export default function DialysisCreate() {
|
||||
Taro.showToast({ title: '创建成功', icon: 'success' });
|
||||
}
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 操作失败:', err);
|
||||
Taro.showToast({ title: isEdit ? '更新失败' : '创建失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -30,7 +30,8 @@ export default function DialysisDetail() {
|
||||
try {
|
||||
const r = await getDialysisRecord(id);
|
||||
setRecord(r);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -46,7 +47,8 @@ export default function DialysisDetail() {
|
||||
const updated = await reviewDialysisRecord(id, record.version);
|
||||
setRecord(updated);
|
||||
Taro.showToast({ title: '审核完成', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 审核失败:', err);
|
||||
Taro.showToast({ title: '审核失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -60,7 +62,8 @@ export default function DialysisDetail() {
|
||||
const updated = await updateDialysisRecord(id, { status: 'completed' }, record.version);
|
||||
setRecord(updated);
|
||||
Taro.showToast({ title: '已标记完成', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -79,7 +82,8 @@ export default function DialysisDetail() {
|
||||
await deleteDialysisRecord(id, record.version);
|
||||
Taro.showToast({ title: '已删除', icon: 'success' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 删除失败:', err);
|
||||
Taro.showToast({ title: '删除失败', icon: 'none' });
|
||||
setSubmitting(false);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,8 @@ export default function DialysisList() {
|
||||
setRecords(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -89,7 +90,8 @@ export default function DialysisList() {
|
||||
} else {
|
||||
Taro.showToast({ title: '未找到患者', icon: 'none' });
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-dialysis] 搜索失败:', err);
|
||||
Taro.showToast({ title: '搜索失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -97,7 +97,8 @@ export default function PrescriptionCreate() {
|
||||
await createDialysisPrescription(payload);
|
||||
Taro.showToast({ title: '创建成功', icon: 'success' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 创建处方失败:', err);
|
||||
Taro.showToast({ title: '创建失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -28,7 +28,8 @@ export default function PrescriptionDetail() {
|
||||
try {
|
||||
const data = await getDialysisPrescription(id);
|
||||
setRx(data);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -49,7 +50,8 @@ export default function PrescriptionDetail() {
|
||||
const updated = await updateDialysisPrescription(id, { status: 'inactive' }, rx.version);
|
||||
setRx(updated);
|
||||
Taro.showToast({ title: '已停用', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 操作失败:', err);
|
||||
Taro.showToast({ title: '操作失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
@@ -68,7 +70,8 @@ export default function PrescriptionDetail() {
|
||||
await deleteDialysisPrescription(id, rx.version);
|
||||
Taro.showToast({ title: '已删除', icon: 'success' });
|
||||
safeSetTimeout(() => Taro.navigateBack(), 1000);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 删除失败:', err);
|
||||
Taro.showToast({ title: '删除失败', icon: 'none' });
|
||||
setSubmitting(false);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,8 @@ export default function PrescriptionList() {
|
||||
setPrescriptions(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
setPage(p);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -85,7 +86,8 @@ export default function PrescriptionList() {
|
||||
} else {
|
||||
Taro.showToast({ title: '未找到患者', icon: 'none' });
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-prescription] 搜索失败:', err);
|
||||
Taro.showToast({ title: '搜索失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
@@ -26,7 +26,8 @@ export default function ReportDetail() {
|
||||
const r = await getLabReport(patientId, reportId);
|
||||
setReport(r);
|
||||
setDoctorNotes(r.doctor_notes || '');
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 加载失败:', err);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -45,7 +46,8 @@ export default function ReportDetail() {
|
||||
});
|
||||
setReport(updated);
|
||||
Taro.showToast({ title: '审核完成', icon: 'success' });
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 审核失败:', err);
|
||||
Taro.showToast({ title: '审核失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
|
||||
@@ -35,7 +35,8 @@ export default function ReportList() {
|
||||
const res = await listLabReports(currentPatientId, { page: 1, page_size: 50 });
|
||||
setReports(res.data || []);
|
||||
setTotal(res.total || 0);
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 加载数据失败:', err);
|
||||
setError(true);
|
||||
Taro.showToast({ title: '加载失败', icon: 'none' });
|
||||
} finally {
|
||||
@@ -64,7 +65,8 @@ export default function ReportList() {
|
||||
} else {
|
||||
Taro.showToast({ title: '未找到患者', icon: 'none' });
|
||||
}
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.warn('[doctor-report] 搜索失败:', err);
|
||||
Taro.showToast({ title: '搜索失败', icon: 'none' });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user