Skip to content

Commit c722ab9

Browse files
committed
fix(errors): restore file and line info
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.
1 parent da3e18f commit c722ab9

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/gulp-uglify-error.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
'use strict';
22
var makeErrorCause = require('make-error-cause');
33

4-
module.exports = makeErrorCause('GulpUglifyError');
4+
var gulpUglifyError = makeErrorCause('GulpUglifyError');
5+
gulpUglifyError.prototype.toString = function() {
6+
var cause = this.cause || {};
7+
8+
return makeErrorCause.BaseError.prototype.toString.call(this) +
9+
(this.fileName ? '\nFile: ' + this.fileName : '') +
10+
(cause.line ? '\nLine: ' + cause.line : '');
11+
};
12+
13+
module.exports = gulpUglifyError;

0 commit comments

Comments
 (0)