Skip to content

Commit

Permalink
Fix error.stack
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 16, 2019
1 parent 45d2e29 commit 4debb76
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,11 @@ 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)
const stack = getStack(errorA)
return new PluginError({
...PLUGIN_ERROR_OPTS,
...opts,
error: errorA,
stack,
})
return new PluginError({ ...PLUGIN_ERROR_OPTS, ...opts, error: errorA })
}

const PLUGIN_ERROR_OPTS = {
plugin: 'gulp-execa',
showProperties: false,
showStack: true,
}

// `plugin-error` repeats the error message by printing both `error.message`
// and the first line of `error.stack`. We remove that last one.
const getStack = function({ stack, message }) {
return stack.replace(message, '')
}

0 comments on commit 4debb76

Please sign in to comment.