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 guides.rubyonrails.org/i18n.html#using-different-exception-handlers.

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) && key.to_s != "i18n.plural.rule"
    raise exception.to_exception
  else
    super
  end
end