Skip to content

Commit

Permalink
refactor: use Error class for error (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi authored Feb 18, 2019
1 parent 49a28f0 commit 2f3ee34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/processPattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ export default function processPattern(globalRef, pattern) {

if (path.isAbsolute(file.webpackTo)) {
if (output === '/') {
// eslint-disable-next-line no-throw-literal
throw '[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be defined to write to absolute paths';
throw new Error(
'[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be defined to write to absolute paths'
);
}

file.webpackTo = path.relative(output, file.webpackTo);
Expand Down
5 changes: 3 additions & 2 deletions test/CopyPlugin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,9 @@ describe('apply function', () => {
}),
expectedAssetKeys: [],
expectedErrors: [
'[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be ' +
'defined to write to absolute paths',
new Error(
'[copy-webpack-plugin] Using older versions of webpack-dev-server, devServer.outputPath must be defined to write to absolute paths'
),
],
patterns: [
{
Expand Down

0 comments on commit 2f3ee34

Please sign in to comment.