Exception: MC2P::MC2PError
- Inherits:
-
StandardError
- Object
- StandardError
- MC2P::MC2PError
- Defined in:
- lib/errors.rb
Overview
MC2P Error - class used to manage the exceptions related with mc2p library
Direct Known Subclasses
Instance Attribute Summary collapse
-
#json_body ⇒ Object
Returns the value of attribute json_body.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#resource_id ⇒ Object
Returns the value of attribute resource_id.
Instance Method Summary collapse
-
#initialize(message = nil, json_body = nil, resource = nil, resource_id = nil) ⇒ MC2PError
constructor
- Initializes an error Params:
message - Error type
json_body - Response from server
resource - Class resource used when the error raised
resource_id -
Resource id requested when the error raised.
- Class resource used when the error raised
- Response from server
- Error type
- Initializes an error Params:
-
#to_s ⇒ Object
Returns: Error type and response.
Constructor Details
#initialize(message = nil, json_body = nil, resource = nil, resource_id = nil) ⇒ MC2PError
Initializes an error Params:
message-
Error type
json_body-
Response from server
resource-
Class resource used when the error raised
resource_id-
Resource id requested when the error raised
14 15 16 17 18 19 20 21 22 |
# File 'lib/errors.rb', line 14 def initialize( = nil, json_body = nil, resource = nil, resource_id = nil) super() = @json_body = json_body @resource = resource @resource_id = resource_id end |
Instance Attribute Details
#json_body ⇒ Object
Returns the value of attribute json_body.
4 5 6 |
# File 'lib/errors.rb', line 4 def json_body @json_body end |
#resource ⇒ Object
Returns the value of attribute resource.
5 6 7 |
# File 'lib/errors.rb', line 5 def resource @resource end |
#resource_id ⇒ Object
Returns the value of attribute resource_id.
6 7 8 |
# File 'lib/errors.rb', line 6 def resource_id @resource_id end |
Instance Method Details
#to_s ⇒ Object
Returns: Error type and response
25 26 27 |
# File 'lib/errors.rb', line 25 def to_s "#{@_message} #{@json_body}" end |