Error_handler catches exceptions that occur during callbacks that are raised in the event loop. You did not start the loop at the point where the code above is. (I assume Blatter :: Stream.start instead of Blatter :: Stream :: Client.start above).
You can try executing EM.next_tick {Blather :: Stream.start (...)}, which will force it to execute during the reactor cycle.
But, in general, you do not want to continue working after running error_handler. This is basically the last protection line for you to clear any state and exit (and print a stack trace so you know why the application crashed). When it fires, you have no idea what the current state of your application is in, and you cannot really trust the correct or consistent state.
In theory, you can simply wrap Blather's call at the start / save:
begin Blather::Stream.start(...) rescue Exception => e puts e end
What should do the trick for you, you could stick to the logic of repetition.
source share