Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Remove boxen from default error output #9568

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions packages/cli/src/lib/exit.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import boxen from 'boxen'
import chalk from 'chalk'
import terminalLink from 'terminal-link'
import { v4 as uuidv4 } from 'uuid'

Expand Down Expand Up @@ -36,26 +36,23 @@ export function exitWithError(
// the error in telemetry if needed and if the user chooses to share it
const errorReferenceCode = uuidv4()

const line = chalk.red('-'.repeat(process.stderr.columns))

// Generate and print a nice message to the user
const content = [
line,
message,
includeEpilogue && `\n${'-'.repeat(process.stderr.columns - 8)}\n`,
includeEpilogue && `\n${line}`,
includeEpilogue && epilogue,
includeReferenceCode &&
` - Here's your unique error reference to quote: '${errorReferenceCode}'`,
line,
]
.filter(Boolean)
.join('\n')

console.error()
console.error(
boxen(content, {
padding: 1,
borderColor: 'red',
title: `Error`,
titleAlignment: 'left',
})
)
console.error(content)

// Record the error in telemetry
recordTelemetryError(error ?? new Error(message))
Expand Down
Loading