lib/grumlin/exceptions.rb in grumlin-0.1.3 vs lib/grumlin/exceptions.rb in grumlin-0.2.0

- old
+ new

@@ -1,12 +1,18 @@ # frozen_string_literal: true module Grumlin class Error < StandardError; end + class UnknownError < Error; end + class ConnectionError < Error; end + class CannotConnectError < ConnectionError; end + + class DisconnectError < ConnectionError; end + class ConnectionStatusError < Error; end class NotConnectedError < ConnectionStatusError; end class AlreadyConnectedError < ConnectionStatusError; end @@ -22,12 +28,10 @@ end end class UnknownTypeError < ProtocolError; end - class ConnectionClosedError < Error; end - class StatusError < Error attr_reader :status def initialize(status) super(status[:message]) @@ -46,6 +50,22 @@ class ServerError < ServerSideError; end class ServerSerializationError < ServerSideError; end class ServerTimeoutError < ServerSideError; end + + class InternalClientError < Error; end + + class UnknownRequestStoppedError < InternalClientError; end + + class ResourceLeakError < InternalClientError; end + + class UnknownMapKey < InternalClientError + attr_reader :key, :map + + def initialize(key, map) + @key = key + @map = map + super("Cannot cast key #{key} in map #{map}") + end + end end