From 5995a19453d4f43e07734b7e4e8858e7fa77b7d5 Mon Sep 17 00:00:00 2001 From: Shan Carter Date: Mon, 10 Jul 2017 15:06:31 -0700 Subject: [PATCH 1/9] Adding more error information Adding the location and frame information to error logging information. Currently with the webpack devserver only the filename and type of error is output. This adds location and context to the output. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a6bf985a..cc906da8 100644 --- a/index.js +++ b/index.js @@ -33,6 +33,7 @@ module.exports = function(source, map) { } catch (err) { // wrap error to provide correct // context when logging to console - this.callback(new Error(err.toString())); + this.callback(new Error(err.toString() + "\n" + JSON.stringify(err.loc) + "\n" + err.frame)); + } }; From e210670e08e9e433370fa6b0b8898e57d5a8dc4f Mon Sep 17 00:00:00 2001 From: Shan Carter Date: Mon, 10 Jul 2017 15:12:56 -0700 Subject: [PATCH 2/9] Switching quotes --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index cc906da8..05fb9c19 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ module.exports = function(source, map) { } catch (err) { // wrap error to provide correct // context when logging to console - this.callback(new Error(err.toString() + "\n" + JSON.stringify(err.loc) + "\n" + err.frame)); + this.callback(new Error(err.toString() + '\n' + JSON.stringify(err.loc) + '\n' + err.frame)); } }; From 0a4aafd58ed8b5712f25da3a91777b33c5031e04 Mon Sep 17 00:00:00 2001 From: Shan Carter Date: Mon, 10 Jul 2017 15:33:37 -0700 Subject: [PATCH 3/9] Emit error instead of callback --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 05fb9c19..594e487a 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ module.exports = function(source, map) { } catch (err) { // wrap error to provide correct // context when logging to console - this.callback(new Error(err.toString() + '\n' + JSON.stringify(err.loc) + '\n' + err.frame)); + this.emitError('\n' + '\n' + err.toString() + '\n' + err.filename + '\n' + err.frame + '\n'); } }; From 0f1bad851f1356e09b809fb4974aa1fc11e02c77 Mon Sep 17 00:00:00 2001 From: Shan Carter Date: Mon, 10 Jul 2017 15:41:14 -0700 Subject: [PATCH 4/9] Update --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 594e487a..fd0b2c65 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ module.exports = function(source, map) { } catch (err) { // wrap error to provide correct // context when logging to console - this.emitError('\n' + '\n' + err.toString() + '\n' + err.filename + '\n' + err.frame + '\n'); + this.callback(new Error(err.toString() + '\n' + err.frame + '\n'); } }; From cc513f8a5001e78644e3c21c48816e06155e5ea3 Mon Sep 17 00:00:00 2001 From: Shan Carter Date: Mon, 10 Jul 2017 18:19:43 -0700 Subject: [PATCH 5/9] Fixing Paren --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index fd0b2c65..6451fb37 100644 --- a/index.js +++ b/index.js @@ -33,7 +33,7 @@ module.exports = function(source, map) { } catch (err) { // wrap error to provide correct // context when logging to console - this.callback(new Error(err.toString() + '\n' + err.frame + '\n'); + this.callback(new Error(err.toString() + '\n' + err.frame + '\n')); } }; From 9a357c69df64fc971fd8e1f5912e1d39ce69c192 Mon Sep 17 00:00:00 2001 From: Shan Carter Date: Mon, 10 Jul 2017 18:31:36 -0700 Subject: [PATCH 6/9] Update loader.spec.js --- test/loader.spec.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/loader.spec.js b/test/loader.spec.js index 1a288932..ae72ef4f 100644 --- a/test/loader.spec.js +++ b/test/loader.spec.js @@ -57,7 +57,7 @@ describe('loader', function() { expect(err).to.exist; expect(err.message).to.eql( - 'Expected }}} (1:18)\n' + + 'ParseError: Expected }}}\n' + '1:

Count: {{{count}}

\n' + ' ^\n' + '2: ' @@ -75,7 +75,7 @@ describe('loader', function() { expect(err).to.exist; expect(err.message).to.eql( - 'Unexpected token (5:7)\n' + + 'ParseError: Unexpected token\n' + '3: