Commits

Richo Healey  committed 166b2cd

Catch non-existant users

On reconsideration this should be red

  • Participants
  • Parent commits 98dd25c

Comments (0)

Files changed (1)

File lib/twat/actions.rb

 
     def user_feed
       twitter_auth
-      # Fix :default case
-      Twitter.user_timeline(opts[:user]).first.tap do |tweet|
-        puts "#{tweet.user.screen_name.bold.cyan}: #{tweet.text}"
+
+      begin
+        Twitter.user_timeline(opts[:user]).first.tap do |tweet|
+          puts "#{tweet.user.screen_name.bold.cyan}: #{tweet.text}"
+        end
+      rescue Twitter::NotFound
+        puts "#{opts[:user].bold.red} doesn't appear to be a valid user"
       end
     end