Patrick Connor
Patrick Connor

Reputation: 582

Rails Twitter Gem 404 Error Handling in the view

I have this line in my view file:

- tweets = Twitter.user_timeline(@organization.twitter_name)

The attr twitter_name is entered by the user. If they enter an invalid twitter account name, it throws a 404 error.

How can I deal with the error to avoid getting this action controller exception? Twitter::NotFound in Organizations#show

Upvotes: 0

Views: 264

Answers (1)

Zepplock
Zepplock

Reputation: 29135

You ca use rescue to catch an exception and show a user friendly error message

Upvotes: 1

Related Questions