Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Wrap codechecks server calls in try/catch blocks #170

Merged
merged 1 commit into from
Jul 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 27 additions & 6 deletions codechecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,19 @@ module.exports.default = async function gasReporter(options = {}) {
if (!codechecks.isPr()) {
const report = new CodeChecksReport(output.config);
report.generate(output.info);
await codechecks.saveValue(output.namespace, report.newData);

try {
await codechecks.saveValue(output.namespace, report.newData);
console.log(`Successful save: output.namespace was: ${output.namespace}`);
} catch (err) {
console.log(
`If you have a chance, report this incident to the eth-gas-reporter github issues.`
);
console.log(`Codechecks errored running 'saveValue'...\n${err}\n`);
console.log(`output.namespace was: ${output.namespace}`);
console.log(`Saved gas-reporter data was: ${report.newData}`);
}

return;
}

Expand All @@ -52,9 +64,18 @@ module.exports.default = async function gasReporter(options = {}) {
const shortDescription = report.getShortDescription();

// Submit report
await codechecks.success({
name: "Gas Usage",
shortDescription: shortDescription,
longDescription: table
});
try {
await codechecks.success({
name: "Gas Usage",
shortDescription: shortDescription,
longDescription: table
});
} catch (err) {
console.log(
`If you have a chance, report this incident to the eth-gas-reporter github issues.`
);
console.log(`Codechecks errored running 'success'...\n${err}\n`);
console.log(`Short description was: ${shortDescription}`);
console.log(`Table was: ${table}`);
}
};