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

Commit cb1c818

Browse files
committed
Adding custom CLIError class to avoid oclif error
1 parent 766cba6 commit cb1c818

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/command/src/clierror.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export class CLIError extends Error {
2+
constructor(error: string | Error) {
3+
const message = error instanceof Error ? error.message : error
4+
super(message)
5+
}
6+
}

packages/command/src/command.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// tslint:disable:object-curly-spacing
1+
// tslint:disable:object-curly-spacing ordered-imports
22

33
import { Command as Base } from '@oclif/command'
4-
import { CLIError } from '@oclif/errors'
54
export { flags } from '@oclif/command'
6-
export { CLIError } from '@oclif/errors'
5+
import { CLIError } from './clierror'
6+
export { CLIError } from './clierror'
77
import ReadPipedData from './readpipeddata'
88
import Telemetry from './telemetry'
99
const chalk = require('chalk')

packages/command/test/command.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Command} from '../src/command'
2-
import {CLIError} from '@oclif/errors'
2+
import {CLIError} from './../src/clierror'
33
import {expect, fancy} from 'fancy-test'
44
import ReadPipedStdin from '../src/readpipeddata'
55
import * as path from 'path';

0 commit comments

Comments
 (0)