lib/ably/exceptions.rb in ably-0.8.2 vs lib/ably/exceptions.rb in ably-0.8.3
- old
+ new
@@ -14,18 +14,26 @@
def initialize(message, status = nil, code = nil)
super message
@status = status
@code = code
end
+
+ def to_s
+ message = [super]
+ if status || code
+ additional_info = []
+ additional_info << "code: #{code}" if code
+ additional_info << "http status: #{status}" if status
+ message << "(#{additional_info.join(', ')})"
+ end
+ message.join(' ')
+ end
end
# An invalid request was received by Ably
class InvalidRequest < BaseAblyException; end
- # The token is invalid
- class InvalidToken < BaseAblyException; end
-
# Ably Protocol message received that is invalid
class ProtocolError < BaseAblyException; end
# Encryption or Decryption failure
class CipherError < BaseAblyException; end
@@ -37,45 +45,63 @@
class ConnectionError < BaseAblyException
def initialize(message, status = nil, code = nil, base_error = nil)
super message, status, code
@base_error = base_error
end
+
+ def to_s
+ message = [super]
+ message << "#{@base_error}" if @base_error
+ message.join(' < ')
+ end
end
# Connection Timeout accessing Realtime or REST service
- class ConnectionTimeoutError < ConnectionError; end
+ class ConnectionTimeout < ConnectionError; end
# Connection closed unexpectedly
- class ConnectionClosedError < ConnectionError; end
+ class ConnectionClosed < ConnectionError; end
- # Invalid State Change error on a {https://github.com/gocardless/statesman Statesman State Machine}
- class StateChangeError < BaseAblyException; end
+ # Connection suspended
+ class ConnectionSuspended < ConnectionError; end
- # The state of the object is not suitable for this operation
- class IncompatibleStateForOperation < BaseAblyException; end
+ # Connection failed
+ class ConnectionFailed < ConnectionError; end
+ # Invalid State Change error on a {https://github.com/gocardless/statesman Statesman State Machine}
+ class InvalidStateChange < BaseAblyException; end
+
# A generic Ably exception taht supports a status & code.
# See https://github.com/ably/ably-common/blob/master/protocol/errors.json for a list of Ably errors
class Standard < BaseAblyException; end
# The HTTP request has returned a 500 error
class ServerError < BaseAblyException; end
# PaginatedResult cannot retrieve the page
- class InvalidPageError < BaseAblyException; end
+ class PageMissing < BaseAblyException; end
# The expected response from the server was invalid
class InvalidResponseBody < BaseAblyException; end
# The request cannot be performed because it is insecure
- class InsecureRequestError < BaseAblyException; end
+ class InsecureRequest < BaseAblyException; end
# The token request could not be created
- class TokenRequestError < BaseAblyException; end
+ class TokenRequestFailed < BaseAblyException; end
+ # The token has expired
+ class TokenExpired < BaseAblyException; end
+
# The message could not be delivered to the server
- class MessageDeliveryError < BaseAblyException; end
+ class MessageDeliveryFailed < BaseAblyException; end
+ # The client has been configured to not queue messages i.e. only publish down an active connection
+ class MessageQueueingDisabled < BaseAblyException; end
+
# The data payload type is not supported
- class UnsupportedDataTypeError < BaseAblyException; end
+ class UnsupportedDataType < BaseAblyException; end
+
+ # When a channel is detached / failed, certain operations are not permitted such as publishing messages
+ class ChannelInactive < BaseAblyException; end
end
end