Exception: Solace::Errors::ParseError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/solace/errors/parse_error.rb

Overview

JSON parsing failed

Since:

  • 0.0.8

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, body:) ⇒ ParseError

Returns a new instance of ParseError.

Parameters:

  • message (String)

    The error message

  • body (Object)

    The response body

Since:

  • 0.0.8



11
12
13
14
# File 'lib/solace/errors/parse_error.rb', line 11

def initialize(message, body:)
  super(message)
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Since:

  • 0.0.8



7
8
9
# File 'lib/solace/errors/parse_error.rb', line 7

def body
  @body
end

Class Method Details

.format_response(error, response) ⇒ Solace::Errors::ParseError

Formats a response to an error

Parameters:

  • error (JSON::ParserError)

    The JSON-RPC error

  • response (Object)

    The response from the RPC

Returns:

Since:

  • 0.0.8



21
22
23
# File 'lib/solace/errors/parse_error.rb', line 21

def self.format_response(error, response)
  new("Invalid JSON from RPC: #{error.message}", body: response.body)
end