From 294c05f3c8d74cf360cd7f5b8d48b81a5c331b0d Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Mon, 20 May 2019 19:05:19 +0900 Subject: [PATCH 1/2] Custom Exception classes should inherit StandardError instead of Exception. --- app/controllers/application_controller.rb | 2 +- app/controllers/repositories_controller.rb | 4 ++-- app/models/auth_source.rb | 2 +- app/models/repository.rb | 2 +- lib/redmine/default_data/loader.rb | 2 +- lib/redmine/helpers/gantt.rb | 2 +- lib/redmine/wiki_formatting.rb | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 082bab939..91ab6a66e 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -20,7 +20,7 @@ require 'uri' require 'cgi' -class Unauthorized < Exception; end +class Unauthorized < StandardError; end class ApplicationController < ActionController::Base include Redmine::I18n diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 85b421e77..3aed8c62d 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -20,8 +20,8 @@ require 'digest/sha1' require 'redmine/scm/adapters' -class ChangesetNotFound < Exception; end -class InvalidRevisionParam < Exception; end +class ChangesetNotFound < StandardError; end +class InvalidRevisionParam < StandardError; end class RepositoriesController < ApplicationController menu_item :repository diff --git a/app/models/auth_source.rb b/app/models/auth_source.rb index c622b1853..b4bf18f5e 100644 --- a/app/models/auth_source.rb +++ b/app/models/auth_source.rb @@ -19,7 +19,7 @@ # Generic exception for when the AuthSource can not be reached # (eg. can not connect to the LDAP) -class AuthSourceException < Exception; end +class AuthSourceException < StandardError; end class AuthSourceTimeoutException < AuthSourceException; end class AuthSource < ActiveRecord::Base diff --git a/app/models/repository.rb b/app/models/repository.rb index 4331ae21d..0284e1b29 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -17,7 +17,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -class ScmFetchError < Exception; end +class ScmFetchError < StandardError; end class Repository < ActiveRecord::Base include Redmine::Ciphering diff --git a/lib/redmine/default_data/loader.rb b/lib/redmine/default_data/loader.rb index 4eb876e98..ab12dda69 100644 --- a/lib/redmine/default_data/loader.rb +++ b/lib/redmine/default_data/loader.rb @@ -19,7 +19,7 @@ module Redmine module DefaultData - class DataAlreadyLoaded < Exception; end + class DataAlreadyLoaded < StandardError; end module Loader include Redmine::I18n diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 24b4b2300..c42f877e3 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -21,7 +21,7 @@ module Redmine module Helpers # Simple class to handle gantt chart data class Gantt - class MaxLinesLimitReached < Exception + class MaxLinesLimitReached < StandardError end include ERB::Util diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index 14d0dc8b3..7d12c6ed1 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -21,7 +21,7 @@ require 'digest/md5' module Redmine module WikiFormatting - class StaleSectionError < Exception; end + class StaleSectionError < StandardError; end @@formatters = {} -- 2.20.1 (Apple Git-117)