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
[Question] Difference in behavior wrt Chrome native impl #386
Comments
It's not part of the spec, but it is a "nice thing". As RSVP is a typically meant to be included in larger projects this functionality is disabled by default. Although I am considering enabling it be default in 4.0. example: var rsvp = require('rsvp');
var Promise = rsvp.Promise;
Promise.reject(new Error('OMG'));
// => nothing but when enabled: https://github.com/tildeio/rsvp.js#error-handling rsvp.on('error', console.error.bind(console)); no rejection handler: Promise.reject(new Error('OMG'));
// => [Error: OMG] with sync error handler Promise.reject(new Error('OMG')).catch(function(e) { });
// => nothing with micro-task error handler var a = Promise.reject(new Error('OMG'));
Promise.ressolve().then(function() {
return a.catch(function(){ });
});
// => nothing with macro-task error handler (false positive scenario) var a = Promise.reject(new Error('OMG'));
setTimeout(function(){
a.catch(function() { });
}, 0)
// => [Error: OMG] The false positive and overall visibility problem let me to implement a full instrumentation API: https://github.com/tildeio/rsvp.js#instrumentation Which lead to us implementing (for ember) which was part of the inspiration for the chrome promise debugging (currently in canary). Although I am sad, as they did not expose this to user-land libs :( |
@stefanpenner thanks for the detailed explanation. Closing as not a bug. |
@vicb thanks :). I believe this should be a default in 4.0 though |
i added it to the eventual 4.0 todo list #261 |
consider this:
In Chrome there would be a "Uncaught (in promise) native" exception while rsvp implementation does not throw.
I've labelled this as "Question" because I'm not sure what the ES6 spec says about it (it's cryptic to me).
Should rsvp throw or is the current implementation correct ?
The text was updated successfully, but these errors were encountered: