piotrmarat/youtube_it — pull request #1 by jfb (2011-11-15 23:53:23+00:00)
Title: Youtube misbehaves when bad OAuth credentials are presented

````YouTubeIt::Client.current_user```` assumes that the return from the API call to YouTube is a valid XML document. Sadly, when presented with bad OAuth credentials, YouTube returns an HTML document (!) that REXML can't parse, so that

```ruby
def current_user
body = access_token.get("http://gdata.youtube.com/feeds/api/users/default").body
REXML::Document.new(body).elements["entry"].elements['author'].elements['name'].text rescue raise InvalidUserCredentials, body
end
```

throws an NPE. I've added a new exception in Client and throw it if the REXML blows up.

My ruby-fu is weak, so I welcome improvements. But this was biting us hard and I wanted to share.