Sha256: e15dbe3f8e18c43211ba6cc45a0cee0a61da7af31f0ce93a2770a83791a0a700
Contents?: true
Size: 1.18 KB
Versions: 16
Compression:
Stored size: 1.18 KB
Contents
module Fluffle module Errors class BaseError < StandardError def to_response { 'code' => self.code, 'message' => self.message, 'data' => self.data } end end class TimeoutError < StandardError end # Raise this within your own code to get an error that will be faithfully # translated into the code, message, and data member fields of the # spec's `Error` response object class CustomError < BaseError attr_accessor :code, :data def initialize(code: 0, message:, data: nil) @code = code @data = data super message end end # Superclass of all errors that may be raised within the server class ServerError < BaseError # Longer-form description that may be present in the `data` field of # the `Error` response object attr_reader :description def data { 'description' => @description } end end class InvalidRequestError < ServerError def initialize(description) @description = description super 'Invalid Request' end def code -32600 end end end end
Version data entries
16 entries across 16 versions & 1 rubygems