Class Twitter::UnauthorizedError
In: lib/twitter/core.rb
Parent: RESTError

Runtime error leaf class raised when user and/or client credentials are missing or invalid. HTTP code: 401 (aka Unauthorized).

To handle specifically you would do the following:

 begin
   timeline = twitter.timeline_for(:friends, :since => tweet)
 rescue UnauthorizedError => uae
   # do something to prompt for valid credentials to user here.
 end

[Validate]