开发者

Rails Twitter Gem 404 Error Handling in the view

开发者 https://www.devze.com 2023-03-04 17:52 出处:网络
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

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

精彩评论

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