meteorhacks / zones

Zone.js integration for meteor
MIT License
30 stars 11 forks source link

Zones breaks promises #60

Closed nathan-muir closed 8 years ago

nathan-muir commented 10 years ago

The following snippet, performs differently with the meteorhacks:zones package added to my project.

var p = new Promise(function(resolve){
    console.log('Executing a new promise')
    setTimeout(function(){ 
      console.log("Resolving the promise successfully")
      resolve(); 
    }, 300);
});

var thenable = p.then(function(){
  throw new Error('This code threw an error!');
}).then(function(result){
    console.log("Shouldn't be passed here", result);
}, function(err){
    console.log("Should see this message", ' "', err.message, '"');
    // only required if error should bubble to next promise
    return Promise.reject(err);
});

Without Zones: image

With Zones: image

arunoda commented 10 years ago

Interesting. I'll see what's happening here. We haven't zones with Promises. I'll say, what's happening here.

arunoda commented 10 years ago

Can you please try this now. I published a new version 1.3.0 It should not break Promise semantics.