Subject: | FIX: make JSONRPC catch and report exceptions properly. |
What sub handle_method needs is an eval to catch eventual errors. I
added it. See the new sub handle_method below:
sub handle_method {
my ($self, $r) = @_;
my ($method,$params) = $self->get_request_data();
if( my $func = $self->find_method($method, $r) ){
my $result = eval {
$func->($self,@$params);
};
if ($@) {
$self->set_err($@);
}
else {
$self->set_response_data($result);
}
}
else{
$self->set_err("Method '$method' not found.");
}
}