ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-FCP/FCP.pm
(Generate patch)

Comparing AnyEvent-FCP/FCP.pm (file contents):
Revision 1.24 by root, Sun Jun 12 04:44:05 2016 UTC vs.
Revision 1.25 by root, Wed Jun 15 09:20:42 2016 UTC

136=item on_error => $callback->($fcp, $message) 136=item on_error => $callback->($fcp, $message)
137 137
138Invoked on any (fatal) errors, such as unexpected connection close. The 138Invoked on any (fatal) errors, such as unexpected connection close. The
139callback receives the FCP object and a textual error message. 139callback receives the FCP object and a textual error message.
140 140
141=item on_failure => $callback->($fcp, $type, $backtrace, $args, $error) 141=item on_failure => $callback->($fcp, $type, $args, $backtrace, $error)
142 142
143Invoked when an FCP request fails that didn't have a failure callback. See 143Invoked when an FCP request fails that didn't have a failure callback. See
144L<FCP REQUESTS> for details. 144L<FCP REQUESTS> for details.
145 145
146=back 146=back
445 445
446This is a popular choice, but it makes handling errors hard - make sure 446This is a popular choice, but it makes handling errors hard - make sure
447you never generate protocol errors! 447you never generate protocol errors!
448 448
449In the failure case, if an C<on_failure> hook exists, it will be invoked 449In the failure case, if an C<on_failure> hook exists, it will be invoked
450with the FCP object, the request type (the name of the method), a 450with the FCP object, the request type (the name of the method, an arrayref
451(textual) backtrace as generated by C<Carp::longmess>, and arrayref
452containing the arguments from the original request invocation and the 451containing the arguments from the original request invocation, a (textual)
453error object from the server, in this order, e.g.: 452backtrace as generated by C<Carp::longmess>, and the error object from the
453server, in this order, e.g.:
454 454
455 on_failure => sub { 455 on_failure => sub {
456 my ($fcp, $request_type, $backtrace, $orig_args, $error_object) = @_; 456 my ($fcp, $request_type, $orig_args, $backtrace, $error_object) = @_;
457 457
458 warn "FCP failure ($type), $error_object->{code_description} ($error_object->{extra_description})$backtrace"; 458 warn "FCP failure ($type), $error_object->{code_description} ($error_object->{extra_description})$backtrace";
459 exit 1; 459 exit 1;
460 }, 460 },
461 461

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines