mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-15 15:31:44 +00:00
add catch block
This commit is contained in:
parent
31d7d88849
commit
ade1ebf812
2 changed files with 12 additions and 12 deletions
12
dist/index.js
vendored
12
dist/index.js
vendored
|
|
@ -288,12 +288,6 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
request("https://codecov.io/bas", (error, response, body) => {
|
request("https://codecov.io/bas", (error, response, body) => {
|
||||||
if (error && fail_ci) {
|
|
||||||
throw error;
|
|
||||||
} else if (error) {
|
|
||||||
core.warning(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFile("codecov.sh", body, err => {
|
fs.writeFile("codecov.sh", body, err => {
|
||||||
if (err && fail_ci) {
|
if (err && fail_ci) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|
@ -417,6 +411,12 @@ try {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
}).catch(err => {
|
||||||
|
if (fail_ci) {
|
||||||
|
core.setFailed(err.message);
|
||||||
|
} else {
|
||||||
|
core.warning(err.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (fail_ci) {
|
if (fail_ci) {
|
||||||
|
|
|
||||||
12
index.js
12
index.js
|
|
@ -25,12 +25,6 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
request("https://codecov.io/bas", (error, response, body) => {
|
request("https://codecov.io/bas", (error, response, body) => {
|
||||||
if (error && fail_ci) {
|
|
||||||
throw error;
|
|
||||||
} else if (error) {
|
|
||||||
core.warning(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
fs.writeFile("codecov.sh", body, err => {
|
fs.writeFile("codecov.sh", body, err => {
|
||||||
if (err && fail_ci) {
|
if (err && fail_ci) {
|
||||||
throw err;
|
throw err;
|
||||||
|
|
@ -154,6 +148,12 @@ try {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
}).catch(err => {
|
||||||
|
if (fail_ci) {
|
||||||
|
core.setFailed(err.message);
|
||||||
|
} else {
|
||||||
|
core.warning(err.message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (fail_ci) {
|
if (fail_ci) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue