Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

[tweeter] Don't crash when HUBOT_TWEETER_ACCOUNTS is unset. #1269

Merged
merged 1 commit into from
Jan 14, 2014

Conversation

smashwilson
Copy link

The tweeter module currently crashes on startup if HUBOT_TWEETER_ACCOUNTS is unset, without a helpful message; I keep needing to reread the source to remember the variable name, which is especially unhelpful if I'm doing local development with the shell adapter. Here's the stack:

[Fri Jan 10 2014 08:51:38 GMT-0500 (EST)] ERROR Unable to load /home/ash/code/wheatley/node_modules/hubot-scripts/src/scripts/tweeter: SyntaxError: Unexpected token u
  at Object.parse (native)
  at Object.<anonymous> (/home/ash/code/wheatley/node_modules/hubot-scripts/src/scripts/tweeter.coffee:43:3, <js>:9:20)
  at Object.<anonymous> (/home/ash/code/wheatley/node_modules/hubot-scripts/src/scripts/tweeter.coffee:39:1, <js>:64:4)
  at Module._compile (module.js:456:26)
  at Object.loadFile (/home/ash/code/wheatley/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:182:19)
  at Module.load (/home/ash/code/wheatley/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Robot.loadFile (/home/ash/code/wheatley/node_modules/hubot/src/robot.coffee:214:9, <js>:161:11)
  at Robot.loadHubotScripts (/home/ash/code/wheatley/node_modules/hubot/src/robot.coffee:241:7, <js>:194:28)
  at /home/ash/code/wheatley/node_modules/hubot/bin/hubot:98:15, <js>:99:30
  at fs.js:266:14
  at Object.oncomplete (fs.js:107:15)

This PR ensures that tweeter checks the presence of the variable before attempting to parse it, so you have a chance to see the warning, and defaults to an empty set of accounts.

It'll likely be obsoleted by #1179 and #1258; this is just a tiny patch to tide us over until the twitter auth is reworked.

technicalpickles added a commit that referenced this pull request Jan 14, 2014
[tweeter] Don't crash when HUBOT_TWEETER_ACCOUNTS is unset.
@technicalpickles technicalpickles merged commit a4d22b2 into github:master Jan 14, 2014
@technicalpickles
Copy link
Contributor

Good catch, thanks for the fix!

@parkr
Copy link
Contributor

parkr commented Jan 31, 2014

Has this been released yet? Can it be? :puppy_dog_eyes:

@technicalpickles
Copy link
Contributor

Just released 2.5.8, sorry for the wait 😓

@parkr
Copy link
Contributor

parkr commented Jan 31, 2014

No problemo! Thank you!!!! ❤️ 🤘 ⚡ 🎆

@smashwilson smashwilson deleted the tweeter-crash branch March 23, 2022 13:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants