fponticelli / thx.promise

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

Add PromiseRF type. #29

Closed nuttycom closed 7 years ago

nuttycom commented 7 years ago

This is PromiseR with added functionality for tracking errors in a typed fashion, rather than just pushing everything into thx.Error and using unchecked error handlers.

The rationale for this change is that it is difficult to distinguish between fatal errors that should be opaque to the user, and errors which the end-user can be reasonably expected to correct. For the former category, the only reasonable behavior may be to retry the same request; for the latter, the user should modify their calling behavior in order to ensure a correct result. While PromiseR is adequate for the former, it does not communicate the latter case clearly in its type. In any real system, we need both varieties of error handling, hence this commit.