JoshuaKGoldberg / create-typescript-app

Quickstart-friendly TypeScript template with comprehensive, configurable, opinionated tooling. ๐Ÿ’
MIT License
622 stars 62 forks source link

๐Ÿš€ Feature: Better visualization of nested errors #736

Open JoshuaKGoldberg opened 10 months ago

JoshuaKGoldberg commented 10 months ago

Bug Report Checklist

Overview

Right now, if something throws an error, the whole error is logged - including nested call stacks. For example, in #735, what's logged is:

Error: Failed initializing GitHub repository
    at withSpinner (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/shared/cli/spinners.js:16:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async migrateWithOptions (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/migrate/migrateWithOptions.js:43:5)
    at async run (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/migrate/index.js:11:7)
    at async runOrRestore (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/shared/runOrRestore.js:7:5)
    at async Object.migrate (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/migrate/index.js:9:10)
    at async bin (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/bin/index.js:47:10)
    at async file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/bin/index.js:4:20 {
  [cause]: Error: Command failed with exit code 1: gh label edit documentation --color 0075ca --description Improvements or additions to docs --name area: documentation
  label with name "area: documentation" already exists
      at makeError (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/execa/lib/error.js:60:11)
      at handlePromise (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/execa/index.js:124:26)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async initializeRepositoryLabels (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/steps/initializeGitHubRepository/labels/initializeRepositoryLabels.js:17:7)
      at async initializeGitHubRepository (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/steps/initializeGitHubRepository/index.js:9:3)
      at async file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/migrate/migrateWithOptions.js:44:7
      at async withSpinner (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/shared/cli/spinners.js:11:20)
      at async migrateWithOptions (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/migrate/migrateWithOptions.js:43:5)
      at async run (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/migrate/index.js:11:7)
      at async runOrRestore (file:///Users/josh/.npm/_npx/4aa729db9999bfc4/node_modules/create-typescript-app/lib/shared/runOrRestore.js:7:5) {
    shortMessage: 'Command failed with exit code 1: gh label edit documentation --color 0075ca --description Improvements or additions to docs --name area: documentation',
    command: 'gh label edit documentation --color 0075ca --description Improvements or additions to docs --name area: documentation',
    escapedCommand: 'gh label edit documentation --color 0075ca --description "Improvements or additions to docs" --name "area: documentation"',
    exitCode: 1,
    signal: undefined,
    signalDescription: undefined,
    stdout: '',
    stderr: 'label with name "area: documentation" already exists',
    cwd: '/Users/josh/repos/all-contributors-auto-action',
    failed: true,
    timedOut: false,
    isCanceled: false,
    killed: false
  }
}

What an awfully verbose way to log things! Most of those lines are useless, such as the node_modules/ logs.

I want to:

Additional Info

No response

JoshuaKGoldberg commented 10 months ago

Looking at existing packages in the wild: