jdonaldson / promhx

A promise and functional reactive programming library for Haxe
MIT License
145 stars 24 forks source link

Rejected promise and errorPipe/errorThen #50

Closed mcheshkov closed 9 years ago

mcheshkov commented 9 years ago

This is similar to #44

var p = new Promise<Int>();
p.reject(2);
p.then(function(a){
    return true;
}).errorPipe(function(e){
    return Promise.promise(false);
});

I expect result to be Promise with true for no errors, and false for error. I use that in tests. But now it ends up in unhandled exception from update_errors. And if I call reject after errorPipe everything is as expected.

In errorPipe there's then(ret._resolve); and it ends up immediateLinkUpdate, isErrored branch. handleError will check _error.length > 0 before calling next.handleError, immediateLinkUpdate wont.

Similar thing with errorThen.

jdonaldson commented 9 years ago

Thanks for these, I'll give more of a substantial update soon.

jdonaldson commented 9 years ago

I think this is fixed now.