From bed55fd2b3fc40ee47c2e5b8f3937e988c4682f0 Mon Sep 17 00:00:00 2001 From: Aviv Ben Shahar Date: Thu, 24 Aug 2023 15:10:48 +0300 Subject: [PATCH] fix: logs errors now with the same schema --- src/commands/init/init.command.ts | 10 +++++----- src/commands/install/install.command.ts | 8 ++++---- src/commands/shell/shell.command.ts | 8 ++++---- src/commands/update/update.command.ts | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/commands/init/init.command.ts b/src/commands/init/init.command.ts index 9a756a3f..3d00b04b 100644 --- a/src/commands/init/init.command.ts +++ b/src/commands/init/init.command.ts @@ -27,7 +27,7 @@ export class InitCommand extends CommandRunner { await this.unpackBundledAssets() await this.linkNewZsh() } catch (error) { - this.logger.error(`Failed to init shell-config CLI, error: ${error.stack}`) + this.logger.error(`Error InitCommand, error: ${error.stack}`) } } @@ -36,7 +36,7 @@ export class InitCommand extends CommandRunner { const zshPath = resolve(homedir(), '.zshrc') await appendFile(zshPath, '') } catch (error) { - this.logger.error(`Failed ensureZshrcExists, error: ${error.stack}`) + this.logger.error(`Error ensureZshrcExists, error: ${error.stack}`) } } @@ -49,7 +49,7 @@ export class InitCommand extends CommandRunner { await copyFile(rootZshPath, backupRootZshPath) } catch (error) { - this.logger.error(`Failed backupRootZsh, error: ${error.stack}`) + this.logger.error(`Error backupRootZsh, error: ${error.stack}`) } } @@ -68,7 +68,7 @@ export class InitCommand extends CommandRunner { this.logger.debug(`Linking new zsh to ${zshPath}`) await appendFile(zshPath, LINK_SHELL_COMMAND) } catch (error) { - this.logger.error(`Failed linkNewZsh, error: ${error.stack}`) + this.logger.error(`Error linkNewZsh, error: ${error.stack}`) } } @@ -95,7 +95,7 @@ export class InitCommand extends CommandRunner { this.logger.debug(`Finished unpacking bundled assets to ${BASE_PATH}`) } catch (error) { - this.logger.error(`Failed unpackBundledAssets, error: ${error.stack}`) + this.logger.error(`Error unpackBundledAssets, error: ${error.stack}`) throw error } } diff --git a/src/commands/install/install.command.ts b/src/commands/install/install.command.ts index 13a59b02..e53c807c 100644 --- a/src/commands/install/install.command.ts +++ b/src/commands/install/install.command.ts @@ -61,7 +61,7 @@ export class InstallCommand extends CommandRunner { await this.installApp(app) } } catch (error) { - this.logger.error(`Failed install command: ${error.stack}`) + this.logger.error(`Error InstallCommand, error: ${error.stack}`) } } @@ -108,7 +108,7 @@ export class InstallCommand extends CommandRunner { spinner.succeed() } catch (error) { - this.logger.error(`Failed setupAssets, error: ${error.stack}`) + this.logger.error(`Error setupAssets, error: ${error.stack}`) spinner.fail() } } @@ -159,7 +159,7 @@ export class InstallCommand extends CommandRunner { return this.resolveDeps(toCheck, res, depsMap) } catch (error) { if (round === 0) { - this.logger.error(`Failed resolveDeps, error: ${error.stack}`) + this.logger.error(`Error resolveDeps, error: ${error.stack}`) process.exit(1) } else { throw error @@ -181,7 +181,7 @@ export class InstallCommand extends CommandRunner { this.logger.log(`Installed ${name}`) } catch (error) { spinner.fail() - this.logger.error(`Failed installApp app: ${name}, error: ${error.stack}`) + this.logger.error(`Error installApp app: ${name}, error: ${error.stack}`) } } } diff --git a/src/commands/shell/shell.command.ts b/src/commands/shell/shell.command.ts index 43d9a966..d8d216eb 100644 --- a/src/commands/shell/shell.command.ts +++ b/src/commands/shell/shell.command.ts @@ -32,7 +32,7 @@ export class ShellCommand extends CommandRunner { await this.disableModule(module) } } catch (error) { - this.logger.error(`Failed to setup shell: ${error.stack}`) + this.logger.error(`Error ShellCommand, error: ${error.stack}`) } } @@ -57,7 +57,7 @@ export class ShellCommand extends CommandRunner { await this.enableModule(module) } } catch (error) { - this.logger.error(`Failed enableAllModules, error: ${error.stack}`) + this.logger.error(`Error enableAllModules, error: ${error.stack}`) } } @@ -71,7 +71,7 @@ export class ShellCommand extends CommandRunner { await rename(resolvedPath, targetPath) } catch (error) { - this.logger.error(`Failed enableModule ${module.name}, error: ${error.stack}`) + this.logger.error(`Error enableModule ${module.name}, error: ${error.stack}`) } } @@ -84,7 +84,7 @@ export class ShellCommand extends CommandRunner { await rename(resolvedPath, `${resolvedPath}.disabled`) } catch (error) { - this.logger.error(`Failed disableModule ${module.name}, error: ${error.stack}`) + this.logger.error(`Error disableModule ${module.name}, error: ${error.stack}`) } } } diff --git a/src/commands/update/update.command.ts b/src/commands/update/update.command.ts index 35f5e7b3..4062ee54 100644 --- a/src/commands/update/update.command.ts +++ b/src/commands/update/update.command.ts @@ -95,7 +95,7 @@ export class UpdateCommand extends CommandRunner { spinner.succeed('Updated successfully!') } catch (error) { - this.logger.error(`Failed to update: ${error.stack}`) + this.logger.error(`Error UpdateCommand, Error: ${error.stack}`) spinner.fail('Failed to update') } } @@ -116,7 +116,7 @@ export class UpdateCommand extends CommandRunner { return true } catch (error) { - this.logger.error(`Failed verifyCustomVersion, error: ${error.stack}`) + this.logger.error(`Error verifyCustomVersion, error: ${error.stack}`) return false } }