Commit b710f21a by Ryan McKinley Committed by GitHub

Toolkit: catch errors from signing service (#23486)

parent 2da704be
...@@ -77,18 +77,23 @@ const manifestRunner: TaskRunner<ManifestOptions> = async ({ folder }) => { ...@@ -77,18 +77,23 @@ const manifestRunner: TaskRunner<ManifestOptions> = async ({ folder }) => {
console.log('Request Signature:', url); console.log('Request Signature:', url);
const axios = require('axios'); const axios = require('axios');
const info = await axios.post(url, manifest, {
headers: { Authorization: 'Bearer ' + GRAFANA_API_KEY }, try {
responseType: 'arraybuffer', const info = await axios.post(url, manifest, {
}); headers: { Authorization: 'Bearer ' + GRAFANA_API_KEY },
if (info.status === 200) { responseType: 'arraybuffer',
console.log('OK: ', info.data); });
const buffer = new Buffer(info.data, 'binary'); if (info.status === 200) {
fs.writeFileSync(outputPath, buffer); console.log('OK: ', info.data);
} else { const buffer = new Buffer(info.data, 'binary');
console.warn('Error: ', info); fs.writeFileSync(outputPath, buffer);
console.log('Saving the unsigned manifest'); } else {
fs.writeFileSync(outputPath, JSON.stringify(manifest, null, 2)); console.warn('Error: ', info);
console.log('Saving the unsigned manifest');
fs.writeFileSync(outputPath, JSON.stringify(manifest, null, 2));
}
} catch (err) {
console.log('ERROR Fetching response', err);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment