Class: TextHelpers::RaiseExceptionHandler

Inherits:
I18n::ExceptionHandler
  • Object
show all
Defined in:
lib/text_helpers.rb

Overview

RaiseExceptionHandler just raises all exceptions, rather than swallowing MissingTranslation ones. It’s cribbed almost verbatim from edgeguides.rubyonrails.org/i18n.html#customize-your-i18n-setup.

Instance Method Summary collapse

Instance Method Details

#call(exception, locale, key, options) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/text_helpers.rb', line 10

def call(exception, locale, key, options)
  if exception.is_a?(I18n::MissingTranslation)
    raise exception.to_exception
  else
    super
  end
end