You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Roger Meier (JIRA)" <ji...@apache.org> on 2016/01/18 00:11:39 UTC
[jira] [Commented] (THRIFT-3549) Exceptions are not properly
stringified in Perl library
[ https://issues.apache.org/jira/browse/THRIFT-3549?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15103970#comment-15103970 ]
Roger Meier commented on THRIFT-3549:
-------------------------------------
Could you provide a link to the cpan bugtracker and attach the patch, see https://thrift.apache.org/docs/HowToContribute
> Exceptions are not properly stringified in Perl library
> -------------------------------------------------------
>
> Key: THRIFT-3549
> URL: https://issues.apache.org/jira/browse/THRIFT-3549
> Project: Thrift
> Issue Type: Bug
> Components: Perl - Library
> Affects Versions: 0.9.3
> Reporter: David Morel
>
> since exceptions are Thrift::TException objects and are used in numerous places in die() statements, most of the time the error message would be along the lines of:
> {{(in cleanup) Thrift::TException=HASH(0x7fdaa2939900) at (eval 38) line 31}}
> which is absolutely useless. The patch below (as suggested on the cpan bugtracker) overloads stringification of the exception to present something more meaningful, like:
> {{(in cleanup) Thrift::TException error: Thrift::Socket: timed out reading from localhost:10000 (code 0) at (eval 37) line 31.}}
> {noformat}
> --- perl5extralib/Thrift.pm 2016-01-13 11:37:07.000000000 +0100
> +++ Downloads/thrift-0.9.3/lib/perl/lib/Thrift.pm 2015-09-27 04:50:44.000000000 +0200
> @@ -58,15 +58,6 @@
> package Thrift::TException;
> -use overload '""' => sub {
> - return
> - ref( $_[0] )
> - . " error: "
> - . ( $_[0]->{message} || 'empty message' )
> - . " (code "
> - . ( defined $_[0]->{code} ? $_[0]->{code} : 'undefined' ) . ")";
> - };
> -
> sub new {
> my $classname = shift;
> my $self = {message => shift, code => shift || 0};
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)