🐛 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
try {
await taskManager(tasks, 5);
} catch (error) {
throw new Error(error);
}
//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 {
//If there is at least one task left, complete it
const curTask = remainingTasks.pop() as () => Promise<void>;
const curPromise = curTask();
currentlyRunningTasks += 1;
curPromise.then(() => {
curTask().then(() => {
currentlyRunningTasks -= 1;
return startNewTask();
}).catch((error) => {