Updater: Log additional information from ShipIt

This commit is contained in:
Fedor Indutny 2021-07-01 16:40:19 -07:00 committed by GitHub
parent 1032249b82
commit c186517e42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -372,7 +372,10 @@ export async function deleteTempDir(targetDir: string): Promise<void> {
await rimrafPromise(targetDir);
}
export function getPrintableError(error: Error): Error | string {
export function getPrintableError(error: Error | string): Error | string {
if (typeof error === 'string') {
return error;
}
return error && error.stack ? error.stack : error;
}

View File

@ -201,8 +201,10 @@ async function handToAutoUpdate(
try {
serverUrl = getServerUrl(server);
autoUpdater.on('error', (error: Error) => {
logger.error('autoUpdater: error', getPrintableError(error));
autoUpdater.on('error', (...args) => {
logger.error('autoUpdater: error', ...args.map(getPrintableError));
const [error] = args;
reject(error);
});
autoUpdater.on('update-downloaded', () => {