This repository was archived by the owner on Apr 4, 2025. It is now read-only.
File tree 2 files changed +12
-12
lines changed
2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -36,15 +36,18 @@ interface AjvValidationError {
36
36
export class SchemaValidationException extends BaseException {
37
37
public readonly errors : SchemaValidatorError [ ] ;
38
38
39
- constructor ( errors ?: SchemaValidatorError [ ] ) {
39
+ constructor (
40
+ errors ?: SchemaValidatorError [ ] ,
41
+ baseMessage = 'Schema validation failed with the following errors:' ,
42
+ ) {
40
43
if ( ! errors || errors . length === 0 ) {
41
44
super ( 'Schema validation failed.' ) ;
42
45
43
46
return ;
44
47
}
45
48
46
49
const messages = SchemaValidationException . createMessages ( errors ) ;
47
- super ( `Schema validation failed with the following errors: \n ${ messages . join ( '\n ' ) } ` ) ;
50
+ super ( `${ baseMessage } \n ${ messages . join ( '\n ' ) } ` ) ;
48
51
this . errors = errors ;
49
52
}
50
53
Original file line number Diff line number Diff line change 5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
- import {
9
- BaseException ,
10
- deepCopy ,
11
- schema ,
12
- } from '@angular-devkit/core' ;
8
+ import { deepCopy , schema } from '@angular-devkit/core' ;
13
9
import { Observable , of as observableOf } from 'rxjs' ;
14
10
import { first , map , mergeMap } from 'rxjs/operators' ;
15
11
import { SchematicDescription } from '../src' ;
@@ -19,11 +15,12 @@ export type SchematicDesc =
19
15
SchematicDescription < FileSystemCollectionDescription , FileSystemSchematicDescription > ;
20
16
21
17
22
- export class InvalidInputOptions extends BaseException {
23
- // tslint:disable-next-line:no-any
24
- constructor ( options : any , public readonly errors : schema . SchemaValidatorError [ ] ) {
25
- super ( `Schematic input does not validate against the Schema: ${ JSON . stringify ( options ) } \n`
26
- + `Errors:\n ${ schema . SchemaValidationException . createMessages ( errors ) . join ( '\n ' ) } ` ) ;
18
+ export class InvalidInputOptions < T = { } > extends schema . SchemaValidationException {
19
+ constructor ( options : T , errors : schema . SchemaValidatorError [ ] ) {
20
+ super (
21
+ errors ,
22
+ `Schematic input does not validate against the Schema: ${ JSON . stringify ( options ) } \nErrors:\n` ,
23
+ ) ;
27
24
}
28
25
}
29
26
You can’t perform that action at this time.
0 commit comments