Skip to content
This repository was archived by the owner on Apr 15, 2025. It is now read-only.

Commit 280e3d8

Browse files
committed
Throw earlier on invalid cache strategy otherwise first invalid call will result in a file download
1 parent 0c13d5b commit 280e3d8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/FileSystem.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ export class FileSystem {
411411
})
412412
}
413413

414+
// Check for invalid cache strategies
415+
if (cacheStrategy !== 'immutable' && cacheStrategy !== 'mutable') {
416+
throw new Error(`Invalid CacheStrategy ${cacheStrategy} is unhandled`)
417+
}
418+
414419
fileName = fileName || this.getFileNameFromUrl(url)
415420

416421
if (!FileSystem.cacheLock[fileName] || !FileSystem.cacheLock[fileName][componentId]) {
@@ -444,8 +449,6 @@ export class FileSystem {
444449
}),
445450
]).pipe(concatAll())
446451
}
447-
default:
448-
throw new Error(`Invalid CacheStrategy ${cacheStrategy} is unhandled`)
449452
}
450453
}
451454

0 commit comments

Comments
 (0)