Skip to content
Snippets Groups Projects
Unverified Commit f3c8fd23 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

feat: stringify unknown errors for better visibility (#1449)

feat: stringify unknown errors for better visibility
parent 6c57c5f4
No related branches found
No related tags found
No related merge requests found
......@@ -38,8 +38,26 @@ async function handleError(config, err) {
return err.message;
}
// Swallow this error so that other repositories can be processed
logger.error({ err }, `Repository has unknown error`);
logger.error(
{ err },
`Repository has unknown error:\n${stringifyError(err, null, ' ')}`
);
// delete branchList to avoid cleaning up branches
delete config.branchList; // eslint-disable-line no-param-reassign
return 'unknown-error';
}
function stringifyError(err, filter, space) {
let stringifiedError = '';
try {
const plainObject = {};
Object.getOwnPropertyNames(err).forEach(key => {
plainObject[key] = err[key];
});
stringifiedError = JSON.stringify(plainObject, filter, space);
} catch (err2) {
// istanbul ignore next
logger.warn({ err2 }, 'Error stringifying unknown error');
}
return stringifiedError;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment