Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put filename of pug file to process into err object if we catch an error #189

Closed

Conversation

Jikstra
Copy link

@Jikstra Jikstra commented Jul 31, 2018

during pug.compile*
Fixes #188

Copy link
Member

@demurgos demurgos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. I left a few comments to address before merging.

@@ -36,6 +36,7 @@ module.exports = function gulpPug(options) {
}
file.contents = new Buffer(compiled);
} catch (e) {
e.filename = opts.filename;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the fileName option for PluginError instead of mutating the cause.

new PluginError('gulp-pug', e, {fileName: opts.filename})

@@ -13,6 +13,7 @@ test('should emit errors of pug correctly', function(t) {
.pipe(task()
.on('error', function(err) {
t.ok(err);
t.equal(err.filename, __dirname + '/fixtures/pug-error.pug');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path concatenation is not string concatenation. This should use path.join(__dirname, "fixtures", "pug-error.pug")

@demurgos
Copy link
Member

I fixed the CI issues in #190. You should rebase your changes on top of master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error doesn't include filename
2 participants