NAME

Beekeeper::JSONRPC::Error - Representation of a JSON-RPC error

VERSION

Version 0.09

SYNOPSIS

my $client = Beekeeper::Client->instance;

my $resp = $client->call_remote(
    method => 'myapp.svc.foo',
    params => { foo => 'bar' },
);

unless ($resp->success) {
    # Error response
    die $resp->code . $resp->message;
}

DESCRIPTION

Objects of this class represent a JSON-RPC error (see http://www.jsonrpc.org/specification).

When an RPC call could not be executed successfully the worker replies with a Beekeeper::JSONRPC::Error object. These objects may be returned also due to client side errors, like network disconnections or timeouts.

Method Beekeeper::Client::call_remote returns objects of this class on failure.

ACCESSORS

message

Returns a string providing a short description of the error.

code

Returns a number that indicates the error type that occurred.

data

Returns an arbitrary value or data structure containing additional information about the error. This may be present or not.

id

Returns the id of the request it is responding to. It is unique per client connection, and it is used for response matching.

success

Always returns false. It is used to determine if a method was executed successfully or not ($response->result cannot be trusted as it may be undefined on success).

CONSTRUCTORS

new ( %args )

message

A string providing a short description of the error.

code

A number that indicates the error type that occurred.

Error codes from and including -32768 to -32000 are reserved for predefined errors of the JSON-RPC spec.

data

An arbitrary value or data structure containing additional information about the error. This may be present or not.

server_error ( %args )

invalid_params ( %args )

AUTHOR

José Micó, jose.mico@gmail.com

COPYRIGHT AND LICENSE

Copyright 2015-2023 José Micó.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.

This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.