From 2f3ee345f6c11c501a4ba30c8bd46f23ee8fa07a Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Mon, 18 Feb 2019 20:15:37 +0300 Subject: [PATCH] refactor: use `Error` class for error (#336) --- src/processPattern.js | 5 +++-- test/CopyPlugin.test.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/processPattern.js b/src/processPattern.js index 289f0ee2..4e911af1 100644 --- a/src/processPattern.js +++ b/src/processPattern.js @@ -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); diff --git a/test/CopyPlugin.test.js b/test/CopyPlugin.test.js index a332750f..b326bc3f 100644 --- a/test/CopyPlugin.test.js +++ b/test/CopyPlugin.test.js @@ -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: [ {