Skip to content

Commit

Permalink
fix: logs errors now with the same schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Avivbens committed Aug 24, 2023
1 parent 7b60cce commit bed55fd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions src/commands/init/init.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
}

Expand All @@ -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}`)
}
}

Expand All @@ -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}`)
}
}

Expand All @@ -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}`)
}
}

Expand All @@ -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
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/commands/install/install.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
}

Expand Down Expand Up @@ -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()
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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}`)
}
}
}
8 changes: 4 additions & 4 deletions src/commands/shell/shell.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
}

Expand All @@ -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}`)
}
}

Expand All @@ -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}`)
}
}

Expand All @@ -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}`)
}
}
}
4 changes: 2 additions & 2 deletions src/commands/update/update.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
}
Expand All @@ -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
}
}
Expand Down

0 comments on commit bed55fd

Please sign in to comment.