Exceptions we use in the app should inherit off StandardError
This commit is contained in:
parent
24e4808aeb
commit
23ed7e9db8
|
@ -1,4 +1,8 @@
|
||||||
if SiteSetting.notification_email == SiteSetting.defaults[:notification_email]
|
if SiteSetting.notification_email == SiteSetting.defaults[:notification_email]
|
||||||
# don't crash for invalid hostname, which is possible in dev
|
# don't crash for invalid hostname, which is possible in dev
|
||||||
SiteSetting.notification_email = "noreply@#{Discourse.current_hostname}" rescue nil
|
begin
|
||||||
|
SiteSetting.notification_email = "noreply@#{Discourse.current_hostname}"
|
||||||
|
rescue Discourse::InvalidParameters
|
||||||
|
STDERR.puts "Discourse hostname: #{Discourse.current_hostname} is not a valid domain for emails!"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -27,33 +27,33 @@ module Discourse
|
||||||
end
|
end
|
||||||
|
|
||||||
# Expected less matches than what we got in a find
|
# Expected less matches than what we got in a find
|
||||||
class TooManyMatches < Exception; end
|
class TooManyMatches < StandardError; end
|
||||||
|
|
||||||
# When they try to do something they should be logged in for
|
# When they try to do something they should be logged in for
|
||||||
class NotLoggedIn < Exception; end
|
class NotLoggedIn < StandardError; end
|
||||||
|
|
||||||
# When the input is somehow bad
|
# When the input is somehow bad
|
||||||
class InvalidParameters < Exception; end
|
class InvalidParameters < StandardError; end
|
||||||
|
|
||||||
# When they don't have permission to do something
|
# When they don't have permission to do something
|
||||||
class InvalidAccess < Exception; end
|
class InvalidAccess < StandardError; end
|
||||||
|
|
||||||
# When something they want is not found
|
# When something they want is not found
|
||||||
class NotFound < Exception; end
|
class NotFound < StandardError; end
|
||||||
|
|
||||||
# When a setting is missing
|
# When a setting is missing
|
||||||
class SiteSettingMissing < Exception; end
|
class SiteSettingMissing < StandardError; end
|
||||||
|
|
||||||
# When ImageMagick is missing
|
# When ImageMagick is missing
|
||||||
class ImageMagickMissing < Exception; end
|
class ImageMagickMissing < StandardError; end
|
||||||
|
|
||||||
class InvalidPost < Exception; end
|
class InvalidPost < StandardError; end
|
||||||
|
|
||||||
# When read-only mode is enabled
|
# When read-only mode is enabled
|
||||||
class ReadOnly < Exception; end
|
class ReadOnly < StandardError; end
|
||||||
|
|
||||||
# Cross site request forgery
|
# Cross site request forgery
|
||||||
class CSRF < Exception; end
|
class CSRF < StandardError; end
|
||||||
|
|
||||||
def self.filters
|
def self.filters
|
||||||
@filters ||= [:latest, :unread, :new, :read, :posted, :bookmarks]
|
@filters ||= [:latest, :unread, :new, :read, :posted, :bookmarks]
|
||||||
|
|
Loading…
Reference in New Issue