feat: Improve service worker network error handling by returning 503 responses instead of throwing and refine client-side error logging for network unavailability.

This commit is contained in:
kuekhaoyang
2025-11-24 17:52:23 +08:00
parent 0df6c27178
commit 71bf1ba06d
3 changed files with 27 additions and 7 deletions
+4 -1
View File
@@ -12,7 +12,10 @@ export interface Segment {
export async function parseHLSManifest(src: string): Promise<Segment[]> {
const response = await fetch(src);
if (!response.ok) {
throw new Error(`Failed to fetch manifest: ${response.status}`);
const errorMsg = response.status === 503
? `Network unavailable (Service Worker offline): ${src}`
: `Failed to fetch manifest (${response.status}): ${src}`;
throw new Error(errorMsg);
}
const manifestText = await response.text();