class method self.handle_exception

Ruby on Rails 2.3.18

Since v2.3.18 Last seen in v2.3.18 Private

Signature

self.handle_exception(exception, locale, key, options)

Any exceptions thrown in translate will be sent to the @@exception_handler which can be a Symbol, a Proc or any other Object.

If exception_handler is a Symbol then it will simply be sent to I18n as a method call. A Proc will simply be called. In any other case the method #call will be called on the exception_handler object.

Examples:

 I18n.exception_handler = :default_exception_handler             # this is the default
 I18n.default_exception_handler(exception, locale, key, options) # will be called like this

 I18n.exception_handler = lambda { |*args| ... }                 # a lambda
 I18n.exception_handler.call(exception, locale, key, options)    # will be called like this

I18n.exception_handler = I18nExceptionHandler.new                # an object
I18n.exception_handler.call(exception, locale, key, options)     # will be called like this

Parameters

exception req
locale req
key req
options req
Source
# File activesupport/lib/active_support/vendor/i18n-0.4.1/i18n.rb, line 290
    def handle_exception(exception, locale, key, options)
      case config.exception_handler
      when Symbol
        send(config.exception_handler, exception, locale, key, options)
      else
        config.exception_handler.call(exception, locale, key, options)
      end
    end

Defined in activesupport/lib/active_support/vendor/i18n-0.4.1/i18n.rb line 290 · View on GitHub · Improve this page · Find usages on GitHub

Defined in I18n

Type at least 2 characters to search.

↑↓ navigate · open · esc close