lib/ably/exceptions.rb in ably-1.0.7 vs lib/ably/exceptions.rb in ably-1.1.0
- old
+ new
@@ -1,9 +1,10 @@
+require 'ably/modules/exception_codes'
+
module Ably
module Exceptions
TOKEN_EXPIRED_CODE = 40140..40149
- INVALID_CLIENT_ID = 40012
# Base Ably exception class that contains status and code values used by Ably
# Refer to https://github.com/ably/ably-common/blob/master/protocol/errors.json
#
# @!attribute [r] message
@@ -35,10 +36,11 @@
additional_info << "code: #{code}" if code
additional_info << "http status: #{status}" if status
additional_info << "base exception: #{@base_exception.class}" if @base_exception
additional_info << "request_id: #{request_id}" if request_id
message << "(#{additional_info.join(', ')})"
+ message << "-> see https://help.ably.io/error/#{code} for help" if code
end
message.join(' ')
end
def as_json(*args)
@@ -51,10 +53,12 @@
end
# An invalid request was received by Ably
class InvalidRequest < BaseAblyException; end
+ class InvalidCredentials < BaseAblyException; end
+
# Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided
class UnauthorizedRequest < BaseAblyException; end
# The request was a valid request, but Ably is refusing to respond to it
class ForbiddenRequest < BaseAblyException; end
@@ -144,14 +148,16 @@
# When a channel is detached / failed, certain operations are not permitted such as publishing messages
class ChannelInactive < BaseAblyException; end
class IncompatibleClientId < BaseAblyException
- def initialize(messages, status = 400, code = INVALID_CLIENT_ID, *args)
+ def initialize(messages, status = 400, code = Ably::Exceptions::Codes::INVALID_CLIENT_ID, *args)
super(message, status, code, *args)
end
end
# Token request has missing or invalid attributes
class InvalidTokenRequest < BaseAblyException; end
+
+ class PushNotificationsNotSupported < BaseAblyException; end
end
end