Exception: RestMan::Exception
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- RestMan::Exception
show all
- Defined in:
- lib/restman/exception.rb
Overview
:include: _doc/lib/restman/exception.rdoc
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(response = nil, initial_response_code = nil) ⇒ Exception
Returns a new instance of Exception.
8
9
10
11
12
|
# File 'lib/restman/exception.rb', line 8
def initialize response = nil, initial_response_code = nil
@response = response
@message = nil
@initial_response_code = initial_response_code
end
|
Instance Attribute Details
#message ⇒ Object
35
36
37
|
# File 'lib/restman/exception.rb', line 35
def message
@message || default_message
end
|
#original_exception ⇒ Object
Returns the value of attribute original_exception.
5
6
7
|
# File 'lib/restman/exception.rb', line 5
def original_exception
@original_exception
end
|
#response ⇒ Object
Returns the value of attribute response.
4
5
6
|
# File 'lib/restman/exception.rb', line 4
def response
@response
end
|
Instance Method Details
#default_message ⇒ Object
39
40
41
|
# File 'lib/restman/exception.rb', line 39
def default_message
self.class.name
end
|
#http_body ⇒ Object
27
28
29
|
# File 'lib/restman/exception.rb', line 27
def http_body
@response.body if @response
end
|
#http_code ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/restman/exception.rb', line 14
def http_code
if @response
@response.code.to_i
else
@initial_response_code
end
end
|
23
24
25
|
# File 'lib/restman/exception.rb', line 23
def
@response. if @response
end
|
#to_s ⇒ Object
31
32
33
|
# File 'lib/restman/exception.rb', line 31
def to_s
message
end
|