Parent

Methods

Included Modules

Class/Module Index [+]

Quicksearch

I18n::ExceptionHandler

Handles exceptions raised in the backend. All exceptions except for MissingTranslationData exceptions are re-thrown. 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 :throw was given.

Public Instance Methods

call(exception, locale, key, options) click to toggle source
# File lib/i18n/exceptions.rb, line 10
def call(exception, locale, key, options)
  if exception.is_a?(MissingTranslation)
    #
    # TODO: this block is to be replaced by `exception.message` when
    # rescue_format is removed
    if options[:rescue_format] == :html
      if @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
      exception.message
    end

  elsif exception.is_a?(Exception)
    raise exception
  else
    throw :exception, exception
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.