Exception: Rocksky::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Rocksky::Error
- Defined in:
- lib/rocksky/error.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#nsid ⇒ Object
readonly
Returns the value of attribute nsid.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, status: nil, body: nil, nsid: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message, status: nil, body: nil, nsid: nil) ⇒ Error
Returns a new instance of Error.
5 6 7 8 9 10 |
# File 'lib/rocksky/error.rb', line 5 def initialize(, status: nil, body: nil, nsid: nil) super() @status = status @body = body @nsid = nsid end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/rocksky/error.rb', line 3 def body @body end |
#nsid ⇒ Object (readonly)
Returns the value of attribute nsid.
3 4 5 |
# File 'lib/rocksky/error.rb', line 3 def nsid @nsid end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/rocksky/error.rb', line 3 def status @status end |
Class Method Details
.from_response(status, body, nsid: nil) ⇒ Object
12 13 14 15 16 |
# File 'lib/rocksky/error.rb', line 12 def self.from_response(status, body, nsid: nil) = (body) || "request failed" klass = klass_for(status) klass.new(, status: status, body: body, nsid: nsid) end |
.from_transport(cause, nsid: nil) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/rocksky/error.rb', line 18 def self.from_transport(cause, nsid: nil) TransportError.new( "transport error: #{cause.class}: #{cause.}", body: nil, nsid: nsid ) end |