Exception: Errawr::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Errawr::Error
- Defined in:
- lib/errawr/error.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
-
#initialize(key = :unknown, context = {}) ⇒ Error
constructor
A new instance of Error.
- #message ⇒ Object
- #update_context(context) ⇒ Object
Constructor Details
#initialize(key = :unknown, context = {}) ⇒ Error
Returns a new instance of Error.
5 6 7 8 9 10 11 |
# File 'lib/errawr/error.rb', line 5 def initialize(key = :unknown, context = {}) @key = key @context = context.dup @metadata = {} @i18n = I18n.t('errawr.' + @key.to_s) update_context(@context) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
3 4 5 |
# File 'lib/errawr/error.rb', line 3 def context @context end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/errawr/error.rb', line 3 def key @key end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
3 4 5 |
# File 'lib/errawr/error.rb', line 3 def @metadata end |
Instance Method Details
#message ⇒ Object
13 14 15 |
# File 'lib/errawr/error.rb', line 13 def end |
#update_context(context) ⇒ Object
17 18 19 |
# File 'lib/errawr/error.rb', line 17 def update_context(context) process_context(context) end |