🐛 Improve error handling
This commit is contained in:
parent
ce4850e852
commit
110be7f94c
2 changed files with 6 additions and 3 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue