Exception: Bonita::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, body) ⇒ Error

Returns a new instance of Error.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bonita/error.rb', line 6

def initialize(status, body)
  if body['exception']
    mapping = Bonita::ErrorMapping.extract_single(body, :read)
    @java_exception = mapping.exception
    @error_message  = mapping.message
    @explanations   = mapping.explanations
    @status         = status
    values = Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }]
  else
    values = body
  end

  super(values)
end

Instance Attribute Details

#error_messageObject (readonly)

Returns the value of attribute error_message.



4
5
6
# File 'lib/bonita/error.rb', line 4

def error_message
  @error_message
end

#explanationsObject (readonly)

Returns the value of attribute explanations.



4
5
6
# File 'lib/bonita/error.rb', line 4

def explanations
  @explanations
end

#java_exceptionObject (readonly)

Returns the value of attribute java_exception.



4
5
6
# File 'lib/bonita/error.rb', line 4

def java_exception
  @java_exception
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/bonita/error.rb', line 4

def status
  @status
end