From 40092f21ba22337f20b29e3cd7e9a88ac0185986 Mon Sep 17 00:00:00 2001 From: evazion Date: Mon, 26 Dec 2016 16:20:23 -0600 Subject: [PATCH] Remove redundant rescue_from calls. These are redundant because ApplicationController rescues these exceptions already. --- app/controllers/admin/users_controller.rb | 1 - app/controllers/comments_controller.rb | 1 - app/controllers/dmails_controller.rb | 1 - app/controllers/legacy_controller.rb | 1 - app/controllers/maintenance/user/deletions_controller.rb | 2 -- app/controllers/moderator/post/posts_controller.rb | 1 - app/controllers/post_versions_controller.rb | 1 - app/controllers/posts_controller.rb | 4 ---- app/controllers/uploads_controller.rb | 1 - app/controllers/user_name_change_requests_controller.rb | 1 - app/controllers/users_controller.rb | 1 - app/controllers/wiki_pages_controller.rb | 2 -- 12 files changed, 17 deletions(-) diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb index f917eb6b1..748c8fad9 100644 --- a/app/controllers/admin/users_controller.rb +++ b/app/controllers/admin/users_controller.rb @@ -1,7 +1,6 @@ module Admin class UsersController < ApplicationController before_filter :moderator_only - rescue_from User::PrivilegeError, :with => :access_denied def edit @user = User.find(params[:id]) diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 96933d631..86a97ddb9 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -1,7 +1,6 @@ class CommentsController < ApplicationController respond_to :html, :xml, :json before_filter :member_only, :except => [:index, :search, :show] - rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception skip_before_filter :api_check def index diff --git a/app/controllers/dmails_controller.rb b/app/controllers/dmails_controller.rb index 97e19a1d7..8c01895e3 100644 --- a/app/controllers/dmails_controller.rb +++ b/app/controllers/dmails_controller.rb @@ -1,7 +1,6 @@ class DmailsController < ApplicationController respond_to :html, :xml, :json before_filter :member_only - rescue_from User::PrivilegeError, :with => :access_denied def new if params[:respond_to_id] diff --git a/app/controllers/legacy_controller.rb b/app/controllers/legacy_controller.rb index f2204f345..385080220 100644 --- a/app/controllers/legacy_controller.rb +++ b/app/controllers/legacy_controller.rb @@ -1,6 +1,5 @@ class LegacyController < ApplicationController before_filter :member_only, :only => [:create_post] - rescue_from PostSets::SearchError, :with => :rescue_exception def posts @post_set = PostSets::Post.new(tag_query, params[:page], params[:limit], format: "json") diff --git a/app/controllers/maintenance/user/deletions_controller.rb b/app/controllers/maintenance/user/deletions_controller.rb index 2022595b2..a8254da37 100644 --- a/app/controllers/maintenance/user/deletions_controller.rb +++ b/app/controllers/maintenance/user/deletions_controller.rb @@ -1,8 +1,6 @@ module Maintenance module User class DeletionsController < ApplicationController - rescue_from UserDeletion::ValidationError, :with => :rescue_exception - def show end diff --git a/app/controllers/moderator/post/posts_controller.rb b/app/controllers/moderator/post/posts_controller.rb index 38e29cd76..94ceb1166 100644 --- a/app/controllers/moderator/post/posts_controller.rb +++ b/app/controllers/moderator/post/posts_controller.rb @@ -3,7 +3,6 @@ module Moderator class PostsController < ApplicationController before_filter :approver_only, :only => [:delete, :undelete, :move_favorites, :ban, :unban, :confirm_delete, :confirm_move_favorites, :confirm_ban] before_filter :admin_only, :only => [:expunge] - rescue_from ::PostFlag::Error, ::Post::ApprovalError, :with => :rescue_exception skip_before_filter :api_check def confirm_delete diff --git a/app/controllers/post_versions_controller.rb b/app/controllers/post_versions_controller.rb index af484f500..9e434b312 100644 --- a/app/controllers/post_versions_controller.rb +++ b/app/controllers/post_versions_controller.rb @@ -1,6 +1,5 @@ class PostVersionsController < ApplicationController respond_to :html, :xml, :json - rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception def index @post_versions = PostVersion.search(params[:search]).order("updated_at desc, id desc").paginate(params[:page], :limit => params[:limit], :search_count => params[:search]) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 0ddecd2f0..8708a6adf 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -3,10 +3,6 @@ class PostsController < ApplicationController before_filter :builder_only, :only => [:copy_notes] before_filter :enable_cors, :only => [:index, :show] respond_to :html, :xml, :json - rescue_from PostSets::SearchError, :with => :rescue_exception - rescue_from Post::SearchError, :with => :rescue_exception - rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception - rescue_from ActiveRecord::RecordNotFound, :with => :rescue_exception def index if params[:md5].present? diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 560750ca2..9a353aad9 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -1,7 +1,6 @@ class UploadsController < ApplicationController before_filter :member_only respond_to :html, :xml, :json, :js - rescue_from Upload::Error, :with => :rescue_exception def new @upload = Upload.new diff --git a/app/controllers/user_name_change_requests_controller.rb b/app/controllers/user_name_change_requests_controller.rb index 5cbed2686..7c5c79378 100644 --- a/app/controllers/user_name_change_requests_controller.rb +++ b/app/controllers/user_name_change_requests_controller.rb @@ -2,7 +2,6 @@ class UserNameChangeRequestsController < ApplicationController before_filter :member_only, :only => [:index, :show] before_filter :gold_only, :only => [:new, :create] before_filter :admin_only, :only => [:approve, :reject] - rescue_from User::PrivilegeError, :with => :access_denied respond_to :html, :json, :xml def new diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b446f8cd2..9cda71582 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,7 +1,6 @@ class UsersController < ApplicationController respond_to :html, :xml, :json before_filter :member_only, :only => [:edit, :update, :upgrade] - rescue_from User::PrivilegeError, :with => :access_denied skip_before_filter :api_check def new diff --git a/app/controllers/wiki_pages_controller.rb b/app/controllers/wiki_pages_controller.rb index 9dd22b3f3..96b92d4ad 100644 --- a/app/controllers/wiki_pages_controller.rb +++ b/app/controllers/wiki_pages_controller.rb @@ -3,8 +3,6 @@ class WikiPagesController < ApplicationController before_filter :member_only, :except => [:index, :show, :show_or_new] before_filter :builder_only, :only => [:destroy] before_filter :normalize_search_params, :only => [:index] - rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception - rescue_from ActiveRecord::RecordNotFound, :with => :rescue_exception def new @wiki_page = WikiPage.new(params[:wiki_page])