Skip to content
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

Improve Exception Handling #72

Open
rikai opened this issue Oct 28, 2016 · 0 comments
Open

Improve Exception Handling #72

rikai opened this issue Oct 28, 2016 · 0 comments

Comments

@rikai
Copy link
Owner

rikai commented Oct 28, 2016

Currently Showbot will mostly just bail out in the case of exceptions. A good example of this follows:

14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [plugin] schedule: Registering listener for type `connect`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [on handler] Registering handler with pattern `#<Cinch::Pattern:0x00000005307d48 @prefix=nil, @pattern=//, @suffix=nil>`, reacting on `connect`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [plugin] schedule: Registering executor with pattern `#<Cinch::Pattern:0x00000005307500 @prefix=/^!/, @pattern=/next\s*$/i, @suffix=nil>`, reacting on `message`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [on handler] Registering handler with pattern `#<Cinch::Pattern:0x00000005307500 @prefix=/^!/, @pattern=/next\s*$/i, @suffix=nil>`, reacting on `message`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [plugin] schedule: Registering executor with pattern `#<Cinch::Pattern:0x00000005306678 @prefix=/^!/, @pattern=/next\s+(.+)/i, @suffix=nil>`, reacting on `message`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [on handler] Registering handler with pattern `#<Cinch::Pattern:0x00000005306678 @prefix=/^!/, @pattern=/next\s+(.+)/i, @suffix=nil>`, reacting on `message`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [plugin] schedule: Registering executor with pattern `#<Cinch::Pattern:0x000000053059d0 @prefix=/^!/, @pattern=/schedule/i, @suffix=nil>`, reacting on `message`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [on handler] Registering handler with pattern `#<Cinch::Pattern:0x000000053059d0 @prefix=/^!/, @pattern=/schedule/i, @suffix=nil>`, reacting on `message`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [plugin] schedule: Registering timer with interval `600` for method `refresh_calendar`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [on handler] Registering handler with pattern `#<Cinch::Pattern:0x000000053045a8 @prefix=nil, @pattern=//, @suffix=nil>`, reacting on `connect`
14:37:49 irc.1  | [2016/10/15 14:37:49.367] !! [on handler] Registering handler with pattern `#<Cinch::Pattern:0x000000052fff30 @prefix=nil, @pattern=//, @suffix=nil>`, reacting on `disconnect`
14:37:49 irc.1  | /usr/lib/ruby/gems/2.3.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:662:in `block (2 levels) in execute!': Bad Request (Google::APIClient::ClientError)
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/retriable-1.4.1/lib/retriable/retry.rb:27:in `perform'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/retriable-1.4.1/lib/retriable.rb:15:in `retriable'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:645:in `block in execute!'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/retriable-1.4.1/lib/retriable/retry.rb:27:in `perform'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/retriable-1.4.1/lib/retriable.rb:15:in `retriable'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:636:in `execute!'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:368:in `discovery_document'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/google-api-client-0.8.7/lib/google/api_client.rb:413:in `discovered_api'
14:37:49 irc.1  |   from /home/lee/Programming/IRC/Showbot/lib/models/calendar.rb:62:in `new'
14:37:49 irc.1  |   from /home/lee/Programming/IRC/Showbot/lib/cinch/plugins/schedule.rb:43:in `initialize'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinch-2.3.2/lib/cinch/plugin_list.rb:11:in `new'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinch-2.3.2/lib/cinch/plugin_list.rb:11:in `register_plugin'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinch-2.3.2/lib/cinch/plugin_list.rb:16:in `block in register_plugins'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinch-2.3.2/lib/cinch/plugin_list.rb:16:in `each'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinch-2.3.2/lib/cinch/plugin_list.rb:16:in `register_plugins'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinch-2.3.2/lib/cinch/bot.rb:239:in `start'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinchize-0.4.2/lib/cinchize.rb:122:in `block in start'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinchize-0.4.2/lib/cinchize.rb:112:in `loop'
14:37:49 irc.1  |   from /usr/lib/ruby/gems/2.3.0/gems/cinchize-0.4.2/lib/cinchize.rb:112:in `start'
14:37:49 irc.1  |   from showbot_irc.rb:26:in `<main>'
14:37:49 irc.1  | * starting network_test
14:37:50 irc.1  | exited with code 1
14:37:50 system | sending SIGTERM to all processes

In that case, the error message was due to a misconfiguration of the google-api-client settings trickling down to the the calendar plugin, and misconfigurations are where most of

Bailing out is fine, but we need to bail with a more useful error message that explains what the problems are, and in cases where possible, it would be nice rescue and print an easy to spot error message.

Note: This is a general 'exception handling' bug, not restricted to the above example (though that should also be addressed). This bug should be used to point out cases that need to be handled when they arise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant