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:
iven
2026-05-21 13:44:13 +08:00
parent 652cccf66c
commit d576b8ba8f
68 changed files with 223 additions and 124 deletions

View File

@@ -154,7 +154,8 @@ export const useAuthStore = create<AuthState>((set, get) => ({
secureSet('wechat_openid', resp.openid);
set({ loading: false });
return false;
} catch {
} catch (err) {
console.warn('[auth] 微信登录失败:', err);
set({ loading: false });
return false;
}
@@ -183,7 +184,8 @@ export const useAuthStore = create<AuthState>((set, get) => ({
// 登录成功后自动加载患者档案(如果有的话)
get().loadPatients();
return true;
} catch {
} catch (err) {
console.warn('[auth] 账号密码登录失败:', err);
set({ loading: false });
return false;
}
@@ -239,8 +241,8 @@ export const useAuthStore = create<AuthState>((set, get) => ({
if (patients.length > 0 && !get().currentPatient) {
get().setCurrentPatient(patients[0]);
}
} catch {
// 患者列表加载失败不阻塞流程
} catch (err) {
console.warn('[auth] 患者列表加载失败:', err);
}
},

View File

@@ -43,7 +43,8 @@ export const useHealthStore = create<HealthState>((set, get) => ({
|| undefined;
const data = await healthApi.getTodaySummary(patientId);
set({ todaySummary: data, todaySummaryFetchedAt: Date.now(), loading: false, _refreshingToday: false });
} catch {
} catch (err) {
console.warn('[health] 刷新今日摘要失败:', err);
set({ loading: false, _refreshingToday: false });
}
},
@@ -69,7 +70,8 @@ export const useHealthStore = create<HealthState>((set, get) => ({
return { trendData: updated };
});
return points;
} catch {
} catch (err) {
console.warn('[health] 获取趋势数据失败:', err);
return [];
}
},

View File

@@ -28,7 +28,8 @@ export const usePointsStore = create<PointsState>((set, get) => ({
pointsApi.getCheckinStatus(),
]);
set({ account, checkinStatus, loading: false, lastFetched: Date.now() });
} catch {
} catch (err) {
console.warn('[points] 刷新积分数据失败:', err);
set({ loading: false });
}
},
@@ -42,7 +43,8 @@ export const usePointsStore = create<PointsState>((set, get) => ({
const account = await pointsApi.getAccount();
set({ account });
return true;
} catch {
} catch (err) {
console.warn('[points] 签到失败:', err);
return false;
}
},