Skip to content

Commit 97820bf

Browse files
committed
Ensure any string-only errors (weird Brotli) are appropriated error-ified
1 parent 1a78983 commit 97820bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/services/ui-worker.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ ctx.addEventListener('message', async (event: { data: BackgroundRequest }) => {
184184
decodeResult.decodedBuffer
185185
]);
186186
} catch (e: any) {
187+
// Can happen for some Brotli decoding errors:
188+
if (typeof e === 'string') {
189+
e = new Error(e);
190+
}
191+
187192
// Special case for decoding errors: we send the encoded data back with the error, so the user can debug it:
188193
ctx.postMessage({
189194
id: event.data.id,

0 commit comments

Comments
 (0)