lib/i18n/exceptions.rb in i18n-0.5.3 vs lib/i18n/exceptions.rb in i18n-0.5.4
- old
+ new
@@ -1,13 +1,7 @@
require 'cgi'
-class KeyError < IndexError
- def initialize(message = nil)
- super(message || "key not found")
- end
-end unless defined?(KeyError)
-
module I18n
# Handles exceptions raised in the backend. All exceptions except for
# MissingTranslationData exceptions are re-raised. When a MissingTranslationData
# was caught the handler returns an error message string containing the key/scope.
# Note that the exception handler is not called when the option :raise was given.
@@ -17,10 +11,10 @@
if exception.is_a?(MissingTranslationData)
#
# TODO: this block is to be replaced by `exception.message` when
# rescue_format is removed
if options[:rescue_format] == :html
- if @rescue_format_deprecation
+ if !defined?(@rescue_format_deprecation)
$stderr.puts "[DEPRECATED] I18n's :recue_format option will be removed from a future release. All exception messages will be plain text. If you need the exception handler to return an html format please set or pass a custom exception handler."
@rescue_format_deprecation = true
end
exception.html_message
else