Sha256: 4423e80c5028a54926921543557ac2a79f6c9526729a4c34c5fb2331babf4f1e

Contents?: true

Size: 578 Bytes

Versions: 10

Compression:

Stored size: 578 Bytes

Contents

module Motr
  module Errors

    # Default parent Motr error for all custom errors. This handles the base
    # key for the translations and provides the convenience method for
    # translating the messages.
    # 
    class MotrError < StandardError
      BASE_KEY = "motr.errors"
      
      # ##
      # Translate an error message
      # @param [String] key The i18n message key
      # @param [Hash] options Options to pass to the i18n library
      # 
      def translate(key, options)
        ::I18n.translate("#{BASE_KEY}.#{key}", options)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
motr-0.1.1 lib/motr/errors/motr_error.rb
motr-0.1.0 lib/motr/errors/motr_error.rb
motr-0.0.9 lib/motr/errors/motr_error.rb
motr-0.0.8 lib/motr/errors/motr_error.rb
motr-0.0.7 lib/motr/errors/motr_error.rb
motr-0.0.6 lib/motr/errors/motr_error.rb
motr-0.0.5 lib/motr/errors/motr_error.rb
motr-0.0.4 lib/motr/errors/motr_error.rb
motr-0.0.3 lib/motr/errors/motr_error.rb
motr-0.0.2 lib/motr/errors/motr_error.rb