This repository was archived by the owner on Aug 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export class CLIError extends Error {
11
11
oclif : any
12
12
code ?: string
13
13
14
- constructor ( error : string | Error , options : { code ?: string , exit ?: number } = { } ) {
14
+ constructor ( error : string | Error , options : { code ?: string , exit ?: number | false } = { } ) {
15
15
const addExitCode = ( error : any ) => {
16
16
error . oclif = error . oclif || { }
17
17
error . oclif . exit = options . exit === undefined ? 2 : options . exit
Original file line number Diff line number Diff line change @@ -14,8 +14,14 @@ export function exit(code = 0): never {
14
14
throw new ExitError ( code )
15
15
}
16
16
17
- export function error ( err : string | Error , options : { code ?: string , exit ?: number } = { } ) : never {
18
- throw new CLIError ( err , options )
17
+ export function error ( input : string | Error , options : { code ?: string , exit ?: false } ) : void
18
+ export function error ( input : string | Error , options ?: { code ?: string , exit ?: number } ) : never
19
+ export function error ( input : string | Error , options : { code ?: string , exit ?: number | false } = { } ) {
20
+ const err = new CLIError ( input , options )
21
+ if ( options . exit === false ) {
22
+ console . error ( err . render ? err . render ( ) : `Error ${ err . message } ` )
23
+ if ( config . errorLogger ) config . errorLogger . log ( err . stack )
24
+ } else throw err
19
25
}
20
26
21
27
export function warn ( input : string | Error ) {
You can’t perform that action at this time.
0 commit comments