Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix: add exit code to error
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 5, 2018
1 parent 312aa86 commit 4297d2a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@ export class ExitError extends Error {
exitCode = error
error = undefined
}
const addCode = (error: ExitError) => {
const addExitCode = (error: ExitError) => {
error['cli-ux'] = error['cli-ux'] || {}
error['cli-ux'].exit = exitCode
return error
}
if (error instanceof Error) {
return addCode(error as any)
return addExitCode(error as any)
}
super(error || `${exitCode}: ${status}`)
addExitCode(this)
this.code = 'EEXIT'
}
}

0 comments on commit 4297d2a

Please sign in to comment.