@travetto/cli 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/cli",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "CLI infrastructure for Travetto framework",
5
5
  "keywords": [
6
6
  "cli",
@@ -29,7 +29,7 @@
29
29
  "directory": "module/cli"
30
30
  },
31
31
  "dependencies": {
32
- "@travetto/schema": "^4.0.1",
32
+ "@travetto/schema": "^4.0.2",
33
33
  "@travetto/terminal": "^4.0.1"
34
34
  },
35
35
  "travetto": {
package/src/error.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AppError } from '@travetto/base';
1
2
  import { PackageUtil, RuntimeContext } from '@travetto/manifest';
2
3
  import { cliTpl } from './color';
3
4
  import { CliValidationError, CliCommandShape } from './types';
@@ -48,13 +49,11 @@ ${{ identifier: install }}
48
49
  /**
49
50
  * Provides a basic error wrapper for cli validation issues
50
51
  */
51
- export class CliValidationResultError extends Error {
52
- errors: CliValidationError[];
52
+ export class CliValidationResultError extends AppError<{ errors: CliValidationError[] }> {
53
53
  command: CliCommandShape;
54
54
 
55
55
  constructor(command: CliCommandShape, errors: CliValidationError[]) {
56
- super('');
56
+ super('', undefined, { errors });
57
57
  this.command = command;
58
- this.errors = errors;
59
58
  }
60
59
  }
package/src/help.ts CHANGED
@@ -134,7 +134,7 @@ export class HelpUtil {
134
134
  static renderValidationError(err: CliValidationResultError): string {
135
135
  return [
136
136
  cliTpl`${{ failure: 'Execution failed' }}:`,
137
- ...err.errors.map(e => e.source && e.source !== 'custom' ?
137
+ ...err.details.errors.map(e => e.source && e.source !== 'custom' ?
138
138
  cliTpl` * ${{ identifier: validationSourceMap[e.source] }} ${{ subtitle: e.message }}` :
139
139
  cliTpl` * ${{ failure: e.message }}`),
140
140
  '',
package/src/schema.ts CHANGED
@@ -182,7 +182,7 @@ export class CliCommandSchemaUtil {
182
182
  if (!(err instanceof CliValidationResultError) && !(err instanceof ValidationResultError)) {
183
183
  throw err;
184
184
  }
185
- return err.errors.map(v => ({ source: SOURCES[i], ...v }));
185
+ return err.details.errors.map(v => ({ source: SOURCES[i], ...v }));
186
186
  }));
187
187
 
188
188
  const errors = (await Promise.all(results)).flatMap(x => (x ?? []));