[bug 950358] Beefen up the token auth code

This adds some exception handling and other things that beefen up the
token auth code to be more resilient. It'd be super if this alleviates
whatever problem is occurring that's then causing Raven to get all fussy
mcfussypants.
[bug 951702] Handle IOErrors in twitter middleware

Pretty sure this doesn't affect users, but it is a source of errors in
Sentry and it's easy to fix.

In order to fix it, I had to tweak the structure of the code from one big
if-statement into smaller blocks that exit out when they're done.