# HG changeset patch # User nanaya # Date 1603084965 -32400 # Node ID f9fd9d9cab9757fce4782ab1a6882a72acab55c5 # Parent a3c140f01707c302d591ad1ce9b1c399836b3ec7 Handle banned account diff -r a3c140f01707 -r f9fd9d9cab97 app/controllers/tweets_controller.rb --- a/app/controllers/tweets_controller.rb Mon Oct 19 04:10:15 2020 +0900 +++ b/app/controllers/tweets_controller.rb Mon Oct 19 14:22:45 2020 +0900 @@ -12,6 +12,8 @@ return redirect if normalized_screen_name != params[:name] @tweets = client.timeline + rescue Twitter::Error::Forbidden + head :forbidden rescue Twitter::Error::NotFound head :not_found rescue Twitter::Error::Unauthorized @@ -21,6 +23,8 @@ def redirect @user ||= Tweet.new(params[:id].presence || params[:name]).user redirect_to tweet_path(@user.id, normalized_screen_name) + rescue Twitter::Error::Forbidden + head :forbidden rescue Twitter::Error::NotFound head :not_found rescue Twitter::Error::Unauthorized