fix(weather): log failed cell-tile fetches instead of swallowing them

loadLayers did `if (!resp.ok) return`, so a 413 or 400 from
/weather/cells left the map blank with no console error and no UI
feedback — indistinguishable from "no data for this forecast hour".

This is reachable in normal use: the hook sets minZoom: 4, and a z=4
viewport on a wide window clamps to ~4500 sq deg, over GridBounds'
4000 sq deg cap, so zooming all the way out silently drops the
overlay. Zooming back in restores it, which makes the failure look
intermittent and untraceable.

Log the status, requested layers and URL so the next report is
diagnosable from the browser console.
This commit is contained in:
Graham McIntire 2026-08-05 17:40:58 -05:00
parent 65f405cce7
commit bff90da60e
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59

View file

@ -1142,7 +1142,18 @@ export const WeatherMap: WeatherMapHook = {
try {
const resp = await fetch(url, { signal: abort.signal })
if (!resp.ok) return
if (!resp.ok) {
// Never swallow a failed tile fetch. A 413 (viewport too large —
// reachable by zooming to minZoom on a wide window) or a 400
// leaves the map blank with no other signal, which is
// indistinguishable from "no data for this hour" when someone
// reports a missing overlay.
console.warn(
`weather cells fetch failed (${source}): HTTP ${resp.status}`,
{ status: resp.status, layers, url }
)
return
}
const buf = await resp.arrayBuffer()
if (cacheKey !== this.packKey) return