Skip to content
This repository was archived by the owner on Sep 12, 2022. It is now read-only.

Commit 059d0cc

Browse files
committed
Include fileName in options to PluginError, closes lazd#33
1 parent 1fa3c0f commit 059d0cc

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ module.exports = function(opts) {
3232
compiled = handlebars.precompile(ast, compilerOptions).toString();
3333
}
3434
catch (err) {
35-
this.emit('error', new gutil.PluginError(PLUGIN_NAME, err));
35+
this.emit('error', new gutil.PluginError(PLUGIN_NAME, err, {
36+
fileName: file.path
37+
}));
3638
return callback();
3739
}
3840

test/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ describe('gulp-handlebars', function() {
3333
var invalidTemplate = getFixture('Invalid.hbs');
3434

3535
stream.on('error', function(err) {
36+
err.fileName.should.equal('test/fixtures/Invalid.hbs'),
3637
err.should.be.an.instanceOf(Error);
3738
err.message.should.equal(getExpectedString('Error.txt'));
3839
done();

0 commit comments

Comments
 (0)