Sha256: 619705e71256fd80add5019ab167799f6079ec2dbbb10beceaa16fb197097095

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

module LocaleApp
  class ExceptionHandler
    def self.call(exception, locale, key, options)
      LocaleApp.log(exception.message)
      if I18n::MissingTranslationData === exception
        LocaleApp.log("Detected missing translation for key(s) #{key.inspect}")

        [*key].each do |key|
          LocaleApp.missing_translations.add(locale, key, options)
        end

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

I18n.exception_handler = LocaleApp::ExceptionHandler

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
localeapp-0.0.7 lib/locale_app/exception_handler.rb