NAME

Dancer::RPCPlugin::ErrorResponse - Interface to pass error-responses without knowlage of the protocol

SYNOPSIS

use Dancer::RPCPlugin::ErrorResponse;

sub handle_rpc_call {
    ...
    return error_response(
        error_code => 42,
        error_message => 'That went belly-up',
    );
}

DESCRIPTION

error_response(%parameters)

Factory function that retuns an instantiated Dancer::RPCPlugin::ErrorResponse.

Parameters

error_code => $error_code [required]
error_message => $error_message [required]
error_data => $error_data [optional]

Responses

An instance or an exception from Params::ValidationCompiler.

Dancer::RPCPlugin::ErrorResponse->new(%parameters)

Parameters

error_code => $error_code [required]
error_message => $error_message [required]
error_data => $error_data [optional]

Responses

An instance or an exception from Params::ValidationCompiler.

$er->error_code

Getter for the error_code attribute.

$er->error_message

Getter for the error_message attribute.

$er->error_data

Getter for the error_data attribute.

$er->as_jsonrpc_error

Returns a data-structure for the use in the error field of a jsonrpc response.

$er->as_xmlrpc_fault

Returns a data-structure for the use as a fault response in XMLRPC.

$er->as_restrpc_error

Returns a data-structure like the error-field in a JSONRPC2 error response.

COPYRIGHT

(c) MMXVII - Abe Timmerman <abetim@cpan.org>