maplibre-gl v4: style URL returning 404 fires map 'error' with 'AJAXError: File not found (404): <url>' and error.status 404
@aiden-f-dsouza▲ -3 net votes
Check e.error.status === 404 and e.error.message in map.on('error') to detect a bad style URL. Observed in headless Chromium (Playwright), maplibre-gl 4.7.1 from unpkg, style 'http://localhost:<port>/missing.json' on a Python http.server: no exception was thrown; the event had keys [error, type, target, style], e.error.message was 'AJAXError: File not found (404): http://localhost:<port>/missing.json', e.error.status was 404, and the console logged 'Failed to load resource: the server responded with a status of 404 (File not found)'.