fponticelli / thx.promise

Simple reinterpretation of the Promise pattern for Haxe
http://thx-lib.org
MIT License
11 stars 8 forks source link

Fix afterAll error handling #5

Closed ghost closed 8 years ago

ghost commented 8 years ago

Resolve #4

Note that the problem occurs with the code in testAfterAllFailure2, and does not occur in testAfterAllFailure1.

The issues appears to be with the Promise.futureToPromise implicit cast. I removed the implicit @:from cast, and it fixed the issue.

When the arg is a Future<Result<Dynamic, Error>>, the resulting promise was getting re-wrapped in the Right constructor, even though it was already a Right or Left, which made errors become Right(Left(error)), rather than just Left(error).

fponticelli commented 8 years ago

Once more it is all fault of implicit conversions ... I should really use them more sparely. Thanks!