Commit c6c94519 authored by Boris Kocherov's avatar Boris Kocherov

ZipFileStorage: error handling improvements

parent 015fba85
...@@ -164,7 +164,7 @@ ...@@ -164,7 +164,7 @@
return loadZip(this) return loadZip(this)
.push(function (zip) { .push(function (zip) {
if (id !== "" && !(zip.files.hasOwnProperty(id) && zip.files[id].dir)) { if (id !== "" && !(zip.files.hasOwnProperty(id) && zip.files[id].dir)) {
throw new jIO.util.jIOError("Cannot find document", 404); throw new jIO.util.jIOError("Cannot access subdocument", 404);
} }
zip.file(attachId, blob); zip.file(attachId, blob);
return {}; return {};
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
} }
if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) { if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) {
throw new jIO.util.jIOError("Cannot find attachment: " throw new jIO.util.jIOError("Cannot find attachment: "
+ id + " , " + name, + '/' + id + " , " + name,
404); 404);
} }
return zip.file(attachId).async('blob'); return zip.file(attachId).async('blob');
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
} }
if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) { if (!(zip.files.hasOwnProperty(attachId) && !zip.files[attachId].dir)) {
throw new jIO.util.jIOError("Cannot find attachment: " throw new jIO.util.jIOError("Cannot find attachment: "
+ id + " , " + name, + '/' + id + " , " + name,
404); 404);
} }
zip.remove(attachId); zip.remove(attachId);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment