lib/lazier/exceptions.rb in lazier-4.1.0 vs lib/lazier/exceptions.rb in lazier-4.2.0

- old
+ new

@@ -10,21 +10,26 @@ class Debug < ::RuntimeError end # This is the handler for the core I18n gem. class TranslationExceptionHandler < ::I18n::ExceptionHandler - # :nodoc: + # Implements the ExceptionHandler interface for I18n. + # + # @param exception [Exception] The error to raise. + # @param locale [String|Symbol] The locale that was requested. + # @param key [String|Symbol] The key that was requested. + # @param options [Hash] The options passed to the translation. def call(exception, locale, key, options) exception.is_a?(::I18n::MissingTranslation) ? raise(exception.to_exception) : super end end # This exception is raised from {I18n I18n} if a string is not translatable. class MissingTranslation < RuntimeError # Creates a new missing translation exception. # # @param locale [Array] The locale that was requested to use. - # @param message [String] The message that was requested to translate. + # @param message [String|NilClass] The message that was requested to translate. def initialize(locale, message = nil) locale, message = locale if message.nil? super("Unable to load the translation \"#{message}\" for the locale \"#{locale}\".") end end