Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 5b01141

Browse files
committed
Handling oclif/error CLIError in base class
1 parent 8f4567f commit 5b01141

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/command/src/command.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { Command as Base } from '@oclif/command'
44
export { flags } from '@oclif/command'
5+
import { CLIError as OCLIFError} from '@oclif/errors'
56
import { CLIError } from './clierror'
67
export { CLIError } from './clierror'
78
import ReadPipedData from './readpipeddata'
@@ -33,7 +34,7 @@ export abstract class Command extends Base {
3334
}
3435

3536
async catch(err: any) {
36-
if (err instanceof CLIError) {
37+
if (err instanceof CLIError || err instanceof OCLIFError) {
3738
if (!err.message.match(/EEXIT: 0/)) {
3839
this.error(err.message)
3940
}
@@ -71,7 +72,7 @@ export abstract class Command extends Base {
7172
}
7273

7374
private extractError(input: string | Error): string {
74-
return input instanceof Error ? input.message.concat(input.name) : input
75+
return input instanceof Error ? input.name : input
7576
}
7677

7778
private getTelemetryProperties(): Array<string> {

0 commit comments

Comments
 (0)