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 error logging/handling #9

Merged
merged 2 commits into from
Feb 9, 2016
Merged

Conversation

stephenyeargin
Copy link
Member

There are a handful of things that can go awry with setting up this Hubot Script Package. Unfortunately, not all of them are terribly user friendly to report on. This PR logs the errors through the normal robot.logger.* methods and handles some more common cases where an invalid API Key is used, the key does not have API permissions, or some other issue comes up.

Fixes #8

/cc @jamespullar @edbury

There are a handful of things that can go awry with setting up this Hubot Script Package. Unfortunately, not all of them are terribly user friendly to report on. This PR logs the errors through the normal `robot.logger.*` methods and handles some more common cases where an invalid API Key is used, the key does not have API permissions, or some other issue comes up.

Fixes #8
return msg.send "You must configure the HUBOT_YOUTUBE_API_KEY environment variable"
query = msg.match[1]
robot.logger.debug query
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For debug messages, I like to include some string prefix to explain what it is, ie youtube query: #{query}. Without it, you'll just have random strings in the log. Might be worth combining with maxResults below on a single line.

@stephenyeargin
Copy link
Member Author

Updated per comments.

stephenyeargin added a commit that referenced this pull request Feb 9, 2016
@stephenyeargin stephenyeargin merged commit 91f69ef into master Feb 9, 2016
@stephenyeargin stephenyeargin deleted the 8-improve-logging branch February 9, 2016 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants