error-stack-install.js 564 B

1234567891011121314
  1. 'use strict';
  2. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  3. var clearErrorStack = require('../internals/error-stack-clear');
  4. var ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable');
  5. // non-standard V8
  6. var captureStackTrace = Error.captureStackTrace;
  7. module.exports = function (error, C, stack, dropEntries) {
  8. if (ERROR_STACK_INSTALLABLE) {
  9. if (captureStackTrace) captureStackTrace(error, C);
  10. else createNonEnumerableProperty(error, 'stack', clearErrorStack(stack, dropEntries));
  11. }
  12. };