Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usability in development mode with thrown errors #56

Open
kriskowal opened this issue Apr 12, 2015 · 5 comments
Open

Usability in development mode with thrown errors #56

kriskowal opened this issue Apr 12, 2015 · 5 comments

Comments

@kriskowal
Copy link
Owner

Evidently, at least in recent Chrome, errors that are captured and released asynchronously lose their stack traces.

Options to mitigate this would include at least:

  1. rework how we deal with errors, allowing errors to pass through synchronously after we request another flush, at least in development mode if not in production as well, at the expense of the performance and priority of flushing a queue with uncaught exceptions.
  2. find a way to capture the stack trace on the error before deferring. preliminary attempts failed.

cc @rkatic

@ForbesLindesay
Copy link
Collaborator

I noticed this recently as well. It seems like a bug in the chrome dev tools: if I put a breakpoint where the error is being re-thrown and inspect err.stack manually I get the correct value.

@kriskowal
Copy link
Owner Author

Need to produce an isolated case and send it to Chromium https://code.google.com/p/chromium/issues/list

But will also have to work around the problem here, for now.

@ForbesLindesay
Copy link
Collaborator

I'm not sure if hacking around the problem here will be of much use to most promise libraries. I suspect it will only fix the problem in certain isolated cases.

@kriskowal
Copy link
Owner Author

Attempts to isolate have so far been in vain.

I created a bundle from the following and it did not exhibit the missing stack trace problem in Chrome dev tools.

var asap = require('./asap');

asap(function () {
    throw new Error('Fake');
});

I also tried this stand-alone, gradually adding complications without being able to reproduce the problem:

var pendingErrors = [];

function requestThrow() {
    setTimeout(rethrow);
}

function rethrow() {
    throw pendingErrors.shift();
}

function stackFrame() {
    try {
        indirection();
    } catch (error) {
        pendingErrors.push(error);
        requestThrow();
    } finally {
    }
}

function indirection() {
    throw new Error("Example");
}

setTimeout(function () {
    stackFrame();
}, 100);

So there appears to be an exogenous factor.

@rkatic
Copy link
Collaborator

rkatic commented Jul 2, 2015

We could always add an asap.forceSyncThrow. Finding a workaround for this issue could be difficult and unreliable. I'm willing to investigate more on this, but this month I will still probably not have much free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants