diff --git a/src/assets.ts b/src/assets.ts index beda4dfc..5c0fd060 100644 --- a/src/assets.ts +++ b/src/assets.ts @@ -106,6 +106,9 @@ export function setupPublicAssetStrategy(options: ModuleOptions['assets'] = {}) let encoding let size = 0 res = await fetch(url).then((r) => { + if (!r.ok) { + throw new Error(`@nuxt/scripts - Failed to download script: ${url}. ${r.statusText} (${r.status})`) + } encoding = r.headers.get('content-encoding') const contentLength = r.headers.get('content-length') size = contentLength ? Number(contentLength) / 1024 : 0