Fix ignoreError().

This commit is contained in:
Fabio Niephaus 2022-08-31 10:57:12 +02:00
parent a39d51e58e
commit c641a461ac
No known key found for this signature in database
GPG Key ID: F21CF5275F31DFD6
2 changed files with 19 additions and 12 deletions

15
dist/cleanup/index.js generated vendored
View File

@ -67015,12 +67015,15 @@ function saveCache() {
*/
function ignoreError(promise) {
return __awaiter(this, void 0, void 0, function* () {
try {
yield promise;
}
catch (error) {
core.warning(error);
}
/* eslint-disable github/no-then */
return new Promise(resolve => {
promise
.catch(error => {
core.warning(error);
resolve(void 0);
})
.then(resolve);
});
});
}
function run() {

View File

@ -45,12 +45,16 @@ async function saveCache(): Promise<void> {
* @param promise the promise to ignore error from
* @returns Promise that will ignore error reported by the given promise
*/
async function ignoreError(promise: Promise<void>): Promise<void> {
try {
await promise
} catch (error) {
core.warning(error)
}
async function ignoreError(promise: Promise<void>): Promise<unknown> {
/* eslint-disable github/no-then */
return new Promise(resolve => {
promise
.catch(error => {
core.warning(error)
resolve(void 0)
})
.then(resolve)
})
}
export async function run(): Promise<void> {