From 4297d2a41f6a9581c9183f662ce5f89602822cf4 Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdxcode@users.noreply.github.com> Date: Sun, 4 Feb 2018 21:55:16 -0800 Subject: [PATCH] fix: add exit code to error --- src/errors.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/errors.ts b/src/errors.ts index 5a904716..8ecaa472 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -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' } }