|
NAMEDancer::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',
);
}
DESCRIPTIONerror_response(%parameters)Factory function that retuns an instantiated Dancer::RPCPlugin::ErrorResponse. Parameters
Responses An instance or an exception from Params::ValidationCompiler. register_error_responses($protocol => \%error_code_to_status_map) register_error_responses(
xmlrpc => {
default => 200,
}
)
register_error_responses(
restish => {
default => 500,
-32700 => 400,
-32701 => 400,
-32702 => 400,
-32600 => 400,
...
}
);
Dancer::RPCPlugin::ErrorResponse->new(%parameters)Parameters
Responses An instance or an exception from Params::ValidationCompiler. $er->return_statusMethod that returns the HTTP status code from the map provided in Dancer::RPCPlugin::ErrorResponse::register_error_responses() $er->error_codeGetter for the "error_code" attribute. $er->error_messageGetter for the "error_message" attribute. $er->error_dataGetter for the "error_data" attribute. $er->as_jsonrpc_errorReturns a data-structure for the use in the "error" field of a jsonrpc response. $er->as_restrpc_errorReturns a data-structure like the "error-field" in a JSONRPC2 error response. $er->as_xmlrpc_faultReturns a data-structure for the use as a "fault" response in XMLRPC. COPYRIGHT(c) MMXVII - Abe Timmerman <abetim@cpan.org>
|