opened
gajus
username_0
When used in combination with https://github.com/mattinsler/longjohn, produces no stack trace.

Extending Error object directly:

```
/Users/username_0/Documents/dev/username_0/mightyql/dist/index.js:86
    throw new _errors.NotFoundError();
          ^
Error: Resource not found.
    at exports.many (/Users/username_0/Documents/dev/username_0/mightyql/dist/index.js:86:11)
---------------------------------------------
    at Object.<anonymous> (/Users/username_0/Documents/dev/applaudience/showtime-api/src/bin/server.js:42:9)
    at Module._compile (module.js:571:32)
    at loader (/Users/username_0/Documents/dev/applaudience/showtime-api/node_modules/babel-register/lib/node.js:144:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/username_0/Documents/dev/applaudience/showtime-api/node_modules/babel-register/lib/node.js:154:7)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Function.Module.runMain (module.js:605:10)
    at Object.<anonymous> (/Users/username_0/Documents/dev/applaudience/showtime-api/node_modules/babel-cli/lib/_babel-node.js:154:22)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)

```

Extending `es6-error`:

```
/Users/username_0/Documents/dev/username_0/mightyql/dist/index.js:86
    throw new _errors.NotFoundError();
          ^
NotFoundError: Resource not found.
    at exports.many (/Users/username_0/Documents/dev/username_0/mightyql/dist/index.js:86:11)

```
Does not work in combination with longjohn
issue
created
gajus
username_0
This is a major bummer, because it makes it impossible to debug code that uses `setTimeout`, `setImmediate`, `nextTick`.
comment
created
bjyoungblood
username_1
Can you provide a simple example that causes this? Using node v7.7.4, the following script gave correct-looking output (I also tried simpler cases with just `setTimeout`, `nextTick`):

```js
require('longjohn');
const { EventEmitter } = require('events');
const ExtendableError = require('es6-error');

class NotFoundError extends ExtendableError {}

class MyEE extends EventEmitter {
  emitErr() {
    this.emit('error', new NotFoundError('not found'));
  }
}

let x = new MyEE();

function causeAnErrorSoon() {
  setTimeout(function() {
    x.emitErr();
  }, 500);
}

causeAnErrorSoon();
```

Output:
```
/Users/bjy/workspace/es6-error/test.js:9
    this.emit('error', new NotFoundError('not found'));
                       ^
NotFoundError: not found
    at MyEE.emitErr (/Users/bjy/workspace/es6-error/test.js:9:24)
    at Timeout.<anonymous> (/Users/bjy/workspace/es6-error/test.js:17:7)
    at ontimeout (timers.js:380:14)
    at tryOnTimeout (timers.js:244:5)
    at Timer.listOnTimeout (timers.js:214:5)
---------------------------------------------
    at causeAnErrorSoon (/Users/bjy/workspace/es6-error/test.js:16:3)
    at Object.<anonymous> (/Users/bjy/workspace/es6-error/test.js:21:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:427:7)
```
comment
closed
gajus
username_0
issue
created
gajus
username_0
I think I rushed to report this issue. There is something low level going on that I haven't managed to isolate yet. Sorry.

Closing this for now.
comment
created
gajus
username_0
I am not even able to get the expected stack traces with:

```
console.log( "new Error('test').stack", new Error('test').stack );
```

just before throwing the error.
comment
created
bjyoungblood
username_1
No worries! Feel free to reopen if it ends up being an issue with es6-error.
comment