Sha256: 8213c9489b32bd905c7819ab04c9eae4ed3993ce61a443bd0cd1e106e0921a91
Contents?: true
Size: 856 Bytes
Versions: 6
Compression:
Stored size: 856 Bytes
Contents
module SolanaRpcRuby ## # ApiError is a wrapper class for errors # class ApiError < StandardError # Error code. # @return [Integer] attr_reader :code # Error message. # @return [String] attr_reader :message # Initialize object with json response from the API with error. # # @param code [Integer] # @param message [String] # # @return [SolanaRpcRuby::ApiError] def initialize(message:, error_class: nil, code: nil) @code = code @message = message.to_s @error_class = error_class additional_info super @message end private def additional_info wrong_url_errors = [Errno::ECONNREFUSED, SocketError] if wrong_url_errors.include?(@error_class) @message += '. Check if the RPC url you provided is correct.' end end end end
Version data entries
6 entries across 6 versions & 1 rubygems