Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Dancer::RPCPlugin::ErrUsersContributed PerlDancer::RPCPlugin::ErrorResponse(3)

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.

   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

       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->return_status
       Method that returns the HTTP status code	from the map provided in
       "Dancer::RPCPlugin::ErrorResponse::register_error_responses()"

   $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_restrpc_error
       Returns a data-structure	like the "error-field" in a JSONRPC2 error
       response.

   $er->as_xmlrpc_fault
       Returns a data-structure	for the	use as a "fault" response in XMLRPC.

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

perl v5.32.1			  2020-02-1Dancer::RPCPlugin::ErrorResponse(3)

NAME | SYNOPSIS | DESCRIPTION | COPYRIGHT

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Dancer::RPCPlugin::ErrorResponse&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help