Sha256: a9c9abc9031cf90705ba1abbaa064aa073e77b4c278c2fcf0f92be56d1e93b35

Contents?: true

Size: 642 Bytes

Versions: 36

Compression:

Stored size: 642 Bytes

Contents

module Localeapp
  class ExceptionHandler
    def self.call(exception, locale, key, options)
      Localeapp.log(exception.message)
      # Which exact exception is set up by our i18n shims
      if exception.is_a? Localeapp::I18nMissingTranslationException
        Localeapp.log("Detected missing translation for key(s) #{key.inspect}")

        [*key].each do |key|
          Localeapp.missing_translations.add(locale, key, nil, options || {})
        end

        [locale, key].join(', ')
      else
        Localeapp.log('Raising exception')
        raise
      end
    end
  end
end

I18n.exception_handler = Localeapp::ExceptionHandler

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
localeapp-1.0.1 lib/localeapp/exception_handler.rb
localeapp-1.0.0 lib/localeapp/exception_handler.rb
localeapp-0.9.3 lib/localeapp/exception_handler.rb
localeapp-0.9.2 lib/localeapp/exception_handler.rb
localeapp-0.9.1 lib/localeapp/exception_handler.rb
localeapp-0.9.0 lib/localeapp/exception_handler.rb
localeapp-0.8.1 lib/localeapp/exception_handler.rb
localeapp-0.8.0 lib/localeapp/exception_handler.rb
localeapp-0.7.2 lib/localeapp/exception_handler.rb
localeapp-0.7.1 lib/localeapp/exception_handler.rb
localeapp-0.7.0 lib/localeapp/exception_handler.rb
localeapp-0.6.14 lib/localeapp/exception_handler.rb
localeapp-0.6.13 lib/localeapp/exception_handler.rb
localeapp-0.6.12 lib/localeapp/exception_handler.rb
localeapp-0.6.10 lib/localeapp/exception_handler.rb
localeapp-0.6.9 lib/localeapp/exception_handler.rb
localeapp-0.6.8 lib/localeapp/exception_handler.rb
localeapp-0.6.7 lib/localeapp/exception_handler.rb
localeapp-0.6.6 lib/localeapp/exception_handler.rb
localeapp-0.6.5 lib/localeapp/exception_handler.rb