Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 76a171d

Browse files
bebrawjoshwiens
authored andcommitted
feat(errors): show nicer errors if there are extra fields
Now you can see which field caused the error.
1 parent 03bb4aa commit 76a171d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

schema/validator.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ var Ajv = require('ajv');
22
var ajv = new Ajv({allErrors: true});
33

44
module.exports = function validate(schema, data) {
5-
var ajv = new Ajv();
5+
var ajv = new Ajv({
6+
errorDataPath: 'property'
7+
});
68
var isValid = ajv.validate(schema, data);
79

810
if(!isValid) {

test/extract.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe("ExtractTextPlugin.extract()", function() {
2929
ExtractTextPlugin.extract({style: 'file.css'});
3030
},
3131
function(err) {
32-
return err.message === 'data should NOT have additional properties';
32+
return err.message === 'data[\'style\'] should NOT have additional properties';
3333
}
3434
);
3535
});

0 commit comments

Comments
 (0)