summaryrefslogtreecommitdiff
path: root/deps/npm/lib/utils/save-stack.js
blob: 42c4aab5f9448394d6fe44faed43ca63b0f70e57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict'
var inherits = require('inherits')

module.exports = SaveStack

function SaveStack (fn) {
  Error.call(this)
  Error.captureStackTrace(this, fn || SaveStack)
}
inherits(SaveStack, Error)

SaveStack.prototype.completeWith = function (er) {
  this['__' + 'proto' + '__'] = er
  this.stack = this.stack + '\n\n' + er.stack
  return this
}