🐛 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
|
//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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) => {
|
||||||
|
|
Loading…
Reference in a new issue