Enrich fatal HLS errors in Sentry (#11359)

This commit is contained in:
Spence Pope
2026-08-05 10:15:26 -04:00
committed by GitHub
parent 17a8fe87c2
commit 32ec5330b0
4 changed files with 82 additions and 4 deletions
@@ -308,7 +308,53 @@ function useHLS({
) {
setError(new VideoNotFoundError())
} else {
setError(new HLSFatalError(data.details, data.error))
const video = videoRef.current
const mediaError = video?.error
setError(
new HLSFatalError({
detail: data.details,
type: data.type,
cause: data.error,
diagnostics: {
hlsError: {
detail: data.details,
type: data.type,
sourceBufferName: data.sourceBufferName,
parent: data.parent,
reason: data.reason,
errorName: data.error.name,
errorCode: (data.error as DOMException).code,
},
fragment: data.frag
? {
sn: data.frag.sn,
level: data.frag.level,
type: data.frag.type,
start: data.frag.start,
duration: data.frag.duration,
cc: data.frag.cc,
}
: undefined,
media: video
? {
errorCode: mediaError?.code,
errorMessage: mediaError?.message,
readyState: video.readyState,
networkState: video.networkState,
currentTime: video.currentTime,
paused: video.paused,
ended: video.ended,
seeking: video.seeking,
}
: undefined,
lifecycle: {
documentVisibility: document.visibilityState,
hlsIsCurrent: hlsRef.current === hls,
},
playlist,
},
}),
)
}
} else {
console.error(data.error)