Skip to content

Commit 50dd4cc

Browse files
committed
Improve error message when reading garbage data
In TurboWarp, these messages can be seen by end-users. The guidance to go to stuk.github.io/jszip is not helpful for users. Let's replace it with something more meaningful for us and them.
1 parent fc42341 commit 50dd4cc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/zipEntries.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ ZipEntries.prototype = {
164164
var isGarbage = !this.isSignature(0, sig.LOCAL_FILE_HEADER);
165165

166166
if (isGarbage) {
167-
throw new Error("Can't find end of central directory : is this a zip file ? " +
168-
"If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");
167+
throw new Error("Corrupted zip: can't find zip signature or end of central directory");
169168
} else {
170169
throw new Error("Corrupted zip: can't find end of central directory");
171170
}

test/asserts/load.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,8 @@ QUnit.module("load", function () {
601601
assert.ok(false, "no exception were thrown");
602602
done();
603603
}, function failure(e) {
604-
assert.ok(e.message.match("stuk.github.io/jszip/documentation"), "the error message is useful");
604+
assert.ok(e.message.match("can't find zip signature or end of central directory"), "the error message is useful");
605+
assert.notOk(e.message.match("stuk.github.io/jszip/documentation"), "the error message does not reference jszip website");
605606
done();
606607
});
607608
});

0 commit comments

Comments
 (0)