Error handling

Some errors did not cause the Action to fail
This commit is contained in:
Christian Koop 2020-11-24 11:39:30 +01:00
parent ac639ec332
commit c901bfb72a
No known key found for this signature in database
GPG Key ID: DECCA4CEE0E46D6D
3 changed files with 102 additions and 96 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -34,6 +34,7 @@ const workingDir = resetWorkingDir();
async function run(): Promise<{ code: number, msg?: string }> {
return new Promise(async (resolve, reject): Promise<void> => {
try {
if (versions.length == 0) return resolve({code: 0, msg: 'No version(s) provided to build'});
if (target.length == 0) return resolve({code: 0, msg: 'No target(s) provided to build'});
@ -135,9 +136,14 @@ async function run(): Promise<{ code: number, msg?: string }> {
});
}
(parallelLimit(tasks, threadCount) as unknown as Promise<unknown[]>) // Valid according to docs - types outdated?
.then(() => resolve({code: 0}))
.catch(reject);
parallelLimit(tasks, threadCount, ((err, results) => {
if (err) return reject(err);
resolve({code: 0});
}));
} catch (err) {
reject(err);
}
});
}