Exception: Motr::Errors::MotrError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/motr/errors/motr_error.rb

Overview

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.

Direct Known Subclasses

InvalidOptions, ModuleMissing

Constant Summary collapse

BASE_KEY =
"motr.errors"

Instance Method Summary collapse

Instance Method Details

#translate(key, options) ⇒ Object

## Translate an error message

Parameters:

  • key (String)

    The i18n message key

  • options (Hash)

    Options to pass to the i18n library



16
17
18
# File 'lib/motr/errors/motr_error.rb', line 16

def translate(key, options)
  ::I18n.translate("#{BASE_KEY}.#{key}", options)
end