Class: RestMyCase::Context::Errors::Status

Inherits:
Base
  • Object
show all
Defined in:
lib/rest_my_case/context/errors/status.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from RestMyCase::Context::Errors::Base

Instance Attribute Details

#last_known_errorObject (readonly)

Returns the value of attribute last_known_error.



5
6
7
# File 'lib/rest_my_case/context/errors/status.rb', line 5

def last_known_error
  @last_known_error
end

Instance Method Details

#add(error) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rest_my_case/context/errors/status.rb', line 7

def add(error)
  super

  if error[:status].nil? && error[:message]
    error[:status] = error[:message]
    error[:message] = nil
  end

  error[:status] = error[:status].to_s

  @context.status.send("#{error[:status]}!")

  @last_known_error = error
end