File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -934,7 +934,12 @@ function loadUglify () {
934
934
function isValidSchema ( schema , externalSchema ) {
935
935
if ( externalSchema ) {
936
936
Object . keys ( externalSchema ) . forEach ( key => {
937
- ajv . addSchema ( externalSchema [ key ] , key )
937
+ try {
938
+ ajv . addSchema ( externalSchema [ key ] , key )
939
+ } catch ( err ) {
940
+ err . message = '"' + key + '" ' + err . message
941
+ throw err
942
+ }
938
943
} )
939
944
}
940
945
ajv . compile ( schema )
Original file line number Diff line number Diff line change
1
+ 'use strict'
2
+
3
+ const test = require ( 'tap' ) . test
4
+ const build = require ( '..' )
5
+
6
+ // Covers issue #139
7
+ test ( 'Should throw on invalid schema' , t => {
8
+ t . plan ( 2 )
9
+ try {
10
+ build ( { } , {
11
+ schema : {
12
+ invalid : {
13
+ type : 'Dinosaur'
14
+ }
15
+ }
16
+ } )
17
+ t . fail ( 'should be an invalid schema' )
18
+ } catch ( err ) {
19
+ t . match ( err . message , / ^ " i n v a l i d " s c h e m a i s i n v a l i d : .* / , 'Schema contains invalid key' )
20
+ t . ok ( err )
21
+ }
22
+ } )
You can’t perform that action at this time.
0 commit comments