Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 5, 2022
1 parent e020bf0 commit dc3e531
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { readPackageUp } from 'read-pkg-up'
import UpdateNotifier from 'update-notifier'

import { ErrorTypes, ERROR_PROPS } from '../error/main.js'
import { mergeErrorCause } from '../error/merge/main.js'
import { allowErrorTypes } from '../error/types.js'
import { run, show, remove, dev } from '../main.js'
import { addPadding } from '../report/utils/indent.js'
Expand Down Expand Up @@ -57,7 +58,7 @@ const COMMANDS = { run, show, remove, dev }

// Print CLI errors and exit, depending on the error type
const handleCliError = function (error) {
const errorA = allowErrorTypes(error, ErrorTypes)
const errorA = allowErrorTypes(mergeErrorCause(error), ErrorTypes)
const { exitCode, printStack, indented } = ERROR_PROPS[errorA.name]
const errorMessage = printStack ? errorA.stack : errorA.message
const errorMessageA = indented ? addPadding(errorMessage) : errorMessage
Expand Down

0 comments on commit dc3e531

Please sign in to comment.