Exception: Ably::Exceptions::BaseAblyException
- Inherits:
-
StandardError
- Object
- StandardError
- Ably::Exceptions::BaseAblyException
- Defined in:
- lib/ably/exceptions.rb
Overview
Base Ably exception class that contains status and code values used by Ably Refer to github.com/ably/ably-common/blob/master/protocol/errors.json
Direct Known Subclasses
ChannelInactive, CipherError, ConnectionError, EncoderError, ForbiddenRequest, IncompatibleClientId, InsecureRequest, InvalidRequest, InvalidResponseBody, InvalidStateChange, MessageDeliveryFailed, MessageQueueingDisabled, PageMissing, ProtocolError, ResourceMissing, ServerError, Standard, TokenExpired, TokenRequestFailed, UnauthorizedRequest, UnsupportedDataType
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
Ably specific error code.
-
#message ⇒ String
readonly
Error message from Ably.
-
#status ⇒ String
readonly
HTTP status code of error.
Instance Method Summary collapse
-
#initialize(message, status = nil, code = nil) ⇒ BaseAblyException
constructor
A new instance of BaseAblyException.
- #to_s ⇒ Object
Constructor Details
#initialize(message, status = nil, code = nil) ⇒ BaseAblyException
Returns a new instance of BaseAblyException.
14 15 16 17 18 |
# File 'lib/ably/exceptions.rb', line 14 def initialize(, status = nil, code = nil) super @status = status @code = code end |
Instance Attribute Details
#code ⇒ String (readonly)
Returns Ably specific error code.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ably/exceptions.rb', line 12 class BaseAblyException < StandardError attr_reader :status, :code def initialize(, status = nil, code = nil) super @status = status @code = code end def to_s = [super] if status || code additional_info = [] additional_info << "code: #{code}" if code additional_info << "http status: #{status}" if status << "(#{additional_info.join(', ')})" end .join(' ') end end |
#message ⇒ String (readonly)
Returns Error message from Ably.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ably/exceptions.rb', line 12 class BaseAblyException < StandardError attr_reader :status, :code def initialize(, status = nil, code = nil) super @status = status @code = code end def to_s = [super] if status || code additional_info = [] additional_info << "code: #{code}" if code additional_info << "http status: #{status}" if status << "(#{additional_info.join(', ')})" end .join(' ') end end |
#status ⇒ String (readonly)
Returns HTTP status code of error.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ably/exceptions.rb', line 12 class BaseAblyException < StandardError attr_reader :status, :code def initialize(, status = nil, code = nil) super @status = status @code = code end def to_s = [super] if status || code additional_info = [] additional_info << "code: #{code}" if code additional_info << "http status: #{status}" if status << "(#{additional_info.join(', ')})" end .join(' ') end end |
Instance Method Details
#to_s ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ably/exceptions.rb', line 20 def to_s = [super] if status || code additional_info = [] additional_info << "code: #{code}" if code additional_info << "http status: #{status}" if status << "(#{additional_info.join(', ')})" end .join(' ') end |