Skip to content

Commit

Permalink
fix(errors): restore file and line info
Browse files Browse the repository at this point in the history
When upgrading to version 2.0.0 the errors implementation was changed,
and the "filename" and "line" context was removed from the `toString`
representation. This commit restores the information by extending the
`make-error-cause` method.

Fixes #264.
  • Loading branch information
terinjokes committed Mar 20, 2017
1 parent da3e18f commit c722ab9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/gulp-uglify-error.js
@@ -1,4 +1,13 @@
'use strict';
var makeErrorCause = require('make-error-cause');

module.exports = makeErrorCause('GulpUglifyError');
var gulpUglifyError = makeErrorCause('GulpUglifyError');
gulpUglifyError.prototype.toString = function() {
var cause = this.cause || {};

return makeErrorCause.BaseError.prototype.toString.call(this) +
(this.fileName ? '\nFile: ' + this.fileName : '') +
(cause.line ? '\nLine: ' + cause.line : '');
};

module.exports = gulpUglifyError;

0 comments on commit c722ab9

Please sign in to comment.