Skip to content

Commit

Permalink
Suggest course of action
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Mar 24, 2017
1 parent 4b9b660 commit 2fe82af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/WebpackOptionsValidationError.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ class WebpackOptionsValidationError extends Error {
else
return `${dataPath} ${err.message}`;
} else if(err.keyword === "absolutePath") {
return `${dataPath}: ${err.message}`;
const baseMessage = `${dataPath}: ${err.message}`;
if(dataPath === "configuration.output.filename") {
return `${baseMessage}\n` +
"Please use output.path to specify absolute path and output.filename for the file name.";
}
return baseMessage;
} else {
// eslint-disable-line no-fallthrough
return `${dataPath} ${err.message} (${JSON.stringify(err, 0, 2)}).\n${getSchemaPartText(err.parentSchema)}`;
Expand Down
1 change: 1 addition & 0 deletions test/Validation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ describe("Validation", () => {
},
message: [
" - configuration.output.filename: A relative path is expected. However the provided value \"/bar\" is an absolute path!",
" Please use output.path to specify absolute path and output.filename for the file name."
]
}, {
name: "absolute path",
Expand Down

0 comments on commit 2fe82af

Please sign in to comment.