开发者

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 erro开发者_如何学编程r to avoid getting this action controller exception? Twitter::NotFound in Organizations#show


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜