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

Commit

Permalink
feat(errors): show nicer errors if there are extra fields
Browse files Browse the repository at this point in the history
Now you can see which field caused the error.
  • Loading branch information
bebraw authored and joshwiens committed Jan 28, 2017
1 parent 20fa315 commit 664e78c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion schema/validator.js
Expand Up @@ -2,7 +2,9 @@ var Ajv = require('ajv');
var ajv = new Ajv({allErrors: true});

module.exports = function validate(schema, data) {
var ajv = new Ajv();
var ajv = new Ajv({
errorDataPath: 'property'
});
var isValid = ajv.validate(schema, data);

if(!isValid) {
Expand Down
2 changes: 1 addition & 1 deletion test/extract.test.js
Expand Up @@ -29,7 +29,7 @@ describe("ExtractTextPlugin.extract()", function() {
ExtractTextPlugin.extract({style: 'file.css'});
},
function(err) {
return err.message === 'data should NOT have additional properties';
return err.message === 'data[\'style\'] should NOT have additional properties';
}
);
});
Expand Down

0 comments on commit 664e78c

Please sign in to comment.