-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't trap exceptions #73
Comments
Can you please post a minimal test case that demonstrates the issue? That would make it far easier for me to get this fixed quickly. |
This is as simple as I could get it. I would expect the EM.error_handler() to capture the Blather::Stream::ConnectionFailed exception but it doesn't. Am I doing something weird/wrong/stupid?
|
I'll take a look at this over the weekend. |
Cool. I traced it back to the EM.event_callback method which has a couple of very interesting comments.
|
Clarification: This issue is not just limited to a connection problem. Anytime Blather raises an exception it stops the whole program, the connection problem is just easiest to trigger. :) |
I have this same problem when attempting to capture SASL errors when there is an invalid username or password. |
Any ideas on this? I'm having the same issue. Restarting the process (as suggested in the flapjack issue above) is not possible for me since I have multiple XMPP client connections running in the same process. |
#110 is my preferred solution to this and many other issues with Blather. Unfortunately, time is not easy to come by to fix it. |
Do you have any other suggestions for short-term workarounds besides restarts? All I can think of offhand is to subclass class MyClient < Blather::Client
def unbind
begin
super
rescue Exception => e
log :error, "something bad"
end
end
end |
That seems as good a "solution" as any besides ditching the insanity that is EM. |
I'm writing a bot (using EventMachine + Sinatra) that listens to Jabber messages and responds to them. However, if Blather has a problem it bubbles up Exceptions that, for some reason, I cannot rescue. For example, if I try to connect to a non-existant server I get the following error and my program stops:
I've tried putting begin...rescue around the @client.connect call but the error still gets thrown and my program stops. How do you trap these types of errors in Blather? Am I missing something obvious? I'm fairly new to EM so it might be something I'm not doing properly, but I've tried everything I can think of and nothing prevents this error (or any other Blather Exception) from calling EM.stop on the whole system. :(
The text was updated successfully, but these errors were encountered: