fix(documents): surface timeline density fetch failures via console.warn (#385)
Previously a 5xx, network blip, or JSON parse error all collapsed into the same silent "no buckets" rendering. The widget still degrades gracefully — failure should not block the document list — but operators and Sentry now see the failure in browser devtools instead of having to reverse-engineer a missing chart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -208,14 +208,18 @@ export async function fetchDensity(
|
||||
|
||||
try {
|
||||
const response = await fetch(buildDensityUrl(filters));
|
||||
if (!response.ok) return EMPTY;
|
||||
if (!response.ok) {
|
||||
console.warn(`[timeline] density fetch responded with ${response.status}`);
|
||||
return EMPTY;
|
||||
}
|
||||
const body = (await response.json()) as DocumentDensityResult;
|
||||
return {
|
||||
density: body.buckets,
|
||||
minDate: body.minDate ?? null,
|
||||
maxDate: body.maxDate ?? null
|
||||
};
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.warn('[timeline] density fetch failed', error);
|
||||
return EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user