Exception: Errawr::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/errawr/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextObject (readonly)

Returns the value of attribute context.



3
4
5
# File 'lib/errawr/error.rb', line 3

def context
  @context
end

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/errawr/error.rb', line 3

def key
  @key
end

#metadataObject (readonly)

Returns the value of attribute metadata.



3
4
5
# File 'lib/errawr/error.rb', line 3

def 
  @metadata
end

Instance Method Details

#messageObject



13
14
15
# File 'lib/errawr/error.rb', line 13

def message
  process_message
end

#update_context(context) ⇒ Object



17
18
19
# File 'lib/errawr/error.rb', line 17

def update_context(context)
  process_context(context)
end