Class: QRPC::Protocol::JsonRpc::Error

Inherits:
Abstract::Error show all
Defined in:
lib/qrpc/protocol/json-rpc/error.rb

Overview

JSON-RPC error implementation.

Since:

  • 0.9.0

Instance Attribute Summary

Attributes inherited from Abstract

#options

Instance Method Summary collapse

Methods inherited from Abstract::Error

#initialize

Methods inherited from Abstract

#error, #initialize, #request, #response

Constructor Details

This class inherits a constructor from QRPC::Protocol::Abstract::Error

Instance Method Details

#nativeJsonRpcObjects::Generic::Error

Returns the native object.

Returns:

  • (JsonRpcObjects::Generic::Error)

    native response object

Since:

  • 0.9.0



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/qrpc/protocol/json-rpc/error.rb', line 46

def native
    if @native.nil?
        exception = @options.exception
        request = @options.request
        data = QRPC::Protocol::JsonRpc::Native::ExceptionData::create(exception)
        
        @native = request.native.class::version.error::create(100, "exception raised during processing the request", :error => data.output)
        @native.serializer = @options.serializer
    end
    
    @native
end

#serializeString

Serializes object to the resultant form.

Returns:

  • (String)

    serialized form

Since:

  • 0.9.0



64
65
66
# File 'lib/qrpc/protocol/json-rpc/error.rb', line 64

def serialize
    self.native.serialize
end