Handle errors when stringifying errors in uploads (#1008)

Should hopefully fix a failed publication at
https://github.com/bytecodealliance/wasmtime/runs/471153746. I really am
truly bad at JS.
This commit is contained in:
Alex Crichton
2020-02-27 11:29:52 -06:00
committed by GitHub
parent febc475d8d
commit e47dcc1b37

View File

@@ -94,17 +94,24 @@ async function run() {
} catch (e) { } catch (e) {
if (i === retries - 1) if (i === retries - 1)
throw e; throw e;
console.log("ERROR: ", JSON.stringify(e, null, 2)); logError(e);
console.log("ERROR: ", e.message);
console.log(e.stack);
console.log("RETRYING after 10s"); console.log("RETRYING after 10s");
await sleep(10000) await sleep(10000)
} }
} }
} }
function logError(e) {
console.log("ERROR: ", e.message);
try {
console.log(JSON.stringify(e, null, 2));
} catch (e) {
// ignore json errors for now
}
console.log(e.stack);
}
run().catch(err => { run().catch(err => {
console.log("ERROR: ", JSON.stringify(err, null, 2)); logError(err);
core.setFailed(err.message); core.setFailed(err.message);
console.log(err.stack);
}); });