TomasMikula / ReactFX

Reactive event streams, observable values and more for JavaFX.
BSD 2-Clause "Simplified" License
375 stars 47 forks source link

Version 2.0-M5: missing error handler/new subscriber interface #56

Closed krampenschiesser closed 8 years ago

krampenschiesser commented 8 years ago

I am currently using Version 2.0M5 because of the withDefaultEvent for multiple streams. However I cannot handle exceptions with this version since the mentioned methods are gone and the new subscriber interface is not available. I think I am missing on something but the current https://github.com/TomasMikula/ReactFX/wiki/Error-Handling wiki page doesn't give me much feedback :(

JordanMartinez commented 8 years ago

I think I am missing on something but the current https://github.com/TomasMikula/ReactFX/wiki/Error-Handling wiki page doesn't give me much feedback :(

If you looked at the home page, you'd see it's under the "Obselete" heading...

Could you give an example of what you're trying to do? It sounds like you want to use split or something similar, but I've never used that and become familiar with it myself.

krampenschiesser commented 8 years ago

I am basically just trying to subscribe to exceptions that can be thrown.

TomasMikula commented 8 years ago

The error handling mechanism was removed, since I think it was a bad design choice in the first place (if you did not install any handler, you would have silently missed the exceptions). Exceptions are now not caught at all, they will just be propagated up the call stack.

If the exceptions you want to handle are possible programming bugs, then I suggest not to catch them at all and fix bugs when they show up.

If you use exceptions to represent some kind of undesirable but otherwise perfectly possible state that has to be handled, then don't use exceptions and reflect that in the type of the events. For example, if you were emitting events of type Foo before, you may want to change that to Either<String, Foo>, where the String describes the error message.