🐛 Improve error handling

This commit is contained in:
C-3PO 2018-09-14 06:31:13 +02:00
parent ce4850e852
commit 110be7f94c
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
2 changed files with 6 additions and 3 deletions

View file

@ -175,7 +175,11 @@ export default async function getPatch({ product, from, to, sourceDirectory, tar
} }
//run tasks //run tasks
await taskManager(tasks, 5); try {
await taskManager(tasks, 5);
} catch (error) {
throw new Error(error);
}
//TODO: add option to delete downloaded files once patching is complete //TODO: add option to delete downloaded files once patching is complete
} }

View file

@ -12,9 +12,8 @@ export default function taskManager(tasks: Array<() => Promise<void>>, maxConcur
} else { } else {
//If there is at least one task left, complete it //If there is at least one task left, complete it
const curTask = remainingTasks.pop() as () => Promise<void>; const curTask = remainingTasks.pop() as () => Promise<void>;
const curPromise = curTask();
currentlyRunningTasks += 1; currentlyRunningTasks += 1;
curPromise.then(() => { curTask().then(() => {
currentlyRunningTasks -= 1; currentlyRunningTasks -= 1;
return startNewTask(); return startNewTask();
}).catch((error) => { }).catch((error) => {