Skip to content

Overview ​

When an <img>, <script> or <link> fails to load — a 404 on a hashed bundle after a deploy, a broken CDN, a blocked stylesheet — the browser fires an error event that doesn't bubble and carries no exception, so the global error handler never sees it.

resourceErrorsIntegration listens for these events in the capture phase and sends an error-level log for each one, with the element's tag and resource url as attributes:

Failed to load resource: script https://cdn.example.com/app.4f2a1c.js

Usage ​

ts
import { use } from '@buglapse/browser'
import { resourceErrorsIntegration } from '@buglapse/browser/integrations'

use(resourceErrorsIntegration())

// watch other elements too:
use(resourceErrorsIntegration({ tags: ['img', 'script', 'link', 'video', 'audio'] }))

Options ​

OptionTypeDefaultDescription
tagsstring[]['img', 'script', 'link']Element tag names whose load failures are reported