Поправлен неверный вызов reject

This commit is contained in:
Book Pauk
2020-12-05 01:11:31 +07:00
parent e25375fb7a
commit 0d87043f91
3 changed files with 5 additions and 5 deletions

View File

@@ -171,7 +171,7 @@ class FileDecompressor {
if (this.limitFileSize) { if (this.limitFileSize) {
if ((await fs.stat(filename)).size > this.limitFileSize) { if ((await fs.stat(filename)).size > this.limitFileSize) {
reject('Файл слишком большой'); reject(new Error('Файл слишком большой'));
return; return;
} }
} }

View File

@@ -28,7 +28,7 @@ class LimitedQueue {
get(onPlaceChange) { get(onPlaceChange) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (this.destroyed) if (this.destroyed)
reject('destroyed'); reject(new Error('destroyed'));
const take = () => { const take = () => {
if (this.freed <= 0) if (this.freed <= 0)
@@ -73,7 +73,7 @@ class LimitedQueue {
if (onPlaceChange) if (onPlaceChange)
onPlaceChange(this.listeners.length); onPlaceChange(this.listeners.length);
} else { } else {
reject('Превышен размер очереди ожидания'); reject(new Error('Превышен размер очереди ожидания'));
} }
} }
}); });

View File

@@ -76,13 +76,13 @@ class ZipStreamer {
if (limitFileCount || limitFileSize || decodeEntryNameCallback) { if (limitFileCount || limitFileSize || decodeEntryNameCallback) {
const entries = Object.values(unzip.entries()); const entries = Object.values(unzip.entries());
if (limitFileCount && entries.length > limitFileCount) { if (limitFileCount && entries.length > limitFileCount) {
reject('Слишком много файлов'); reject(new Error('Слишком много файлов'));
return; return;
} }
for (const entry of entries) { for (const entry of entries) {
if (limitFileSize && !entry.isDirectory && entry.size > limitFileSize) { if (limitFileSize && !entry.isDirectory && entry.size > limitFileSize) {
reject('Файл слишком большой'); reject(new Error('Файл слишком большой'));
return; return;
} }