Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.9.3
-
None
-
Patch Available
-
Patch
Description
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.
--- 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};