Skip to content

Commit

Permalink
feat: utilise WebpackOptionsValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Sep 17, 2016
1 parent 91e3640 commit 4526824
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var NodeEnvironmentPlugin = require("./node/NodeEnvironmentPlugin");
var WebpackOptionsApply = require("./WebpackOptionsApply");
var WebpackOptionsDefaulter = require("./WebpackOptionsDefaulter");
var validateWebpackOptions = require("./validateWebpackOptions");
var WebpackOptionsValidationError = require("./WebpackOptionsValidationError");

function webpack(options, callback) {
var compiler;
Expand All @@ -18,9 +19,7 @@ function webpack(options, callback) {
} else if(typeof options === "object") {
var webpackOptionsValidationErrors = validateWebpackOptions(options);
if(webpackOptionsValidationErrors.length) {
var validationError = new Error("Passed 'options' object does not look like a valid webpack configuration");
validationError.validationErrors = webpackOptionsValidationErrors;
throw validationError;
throw new WebpackOptionsValidationError(webpackOptionsValidationErrors);
}
new WebpackOptionsDefaulter().process(options);

Expand Down

0 comments on commit 4526824

Please sign in to comment.