Closed toddself closed 9 years ago
I still agree with this, but my comment was just me getting confused because #13 isn't fixed yet. :P
Bout to read a long ass article about throwing errors and I'll fix this either tonight or first thing in the morning. :)
@toddself @iabw I started on trying to work on this but my brain is mush. I scoped out the authentication stuff into it's own config file entirely, but I think the error handling needs to be worked in case of the particle id or token being invalid.
let me know what you think, if this is even the right direction or if I'm overly complicating things. Or if it's just wrong completely.
I was going to recommend making a config file eventually so you don't have to pass in via env variables, but you've gone and done it!
process.exit()
seems appropriate here too. LGTM!
💁✨
Oops, I missed this discussion. I refactored to a "throw" because it's more testable. We could catch the error in app.js and then process.exit() though.
On https://github.com/rachelnicole/robokitty/blob/master/app.js#L10-L11
You definitely want someone to put that data in there. Since they're required (and the defaults are invalid) you might not want to do the shortcircuit
||
operator, but rather check to see if those variables areundefined
and if they are print out usage instructions:(Or you could throw too, if
app.js
is everrequire
'd by another module, callingprocess.exit
is a pretty rude thing to do to the including program :))