Skip to content

Commit

Permalink
Fix error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 16, 2019
1 parent b2afef2 commit e31ab5a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ export const streamError = function(stream, error, opts) {
// are kept. They are not printed though, as error message should be enough.
const createError = function(error, opts) {
const errorA = error instanceof Error ? error : new Error(error)
fixStack(errorA)
return new PluginError('gulp-execa', errorA, {
showProperties: false,
showStack: true,
...opts,
})
}

// `plugin-error` repeats the error message by printing both `error.message`
// and the first line of `error.stack`. We remove that last one.
const fixStack = function(error) {
// eslint-disable-next-line no-param-reassign, fp/no-mutation
error.stack = error.stack.split('\n').slice(1).join('\n')
}

0 comments on commit e31ab5a

Please sign in to comment.