diff options
author | Roger Meier <roger@apache.org> | 2016-01-25 22:26:39 +0100 |
---|---|---|
committer | Roger Meier <roger@apache.org> | 2016-01-25 22:26:39 +0100 |
commit | 45c8e4935740292b8253041195ed5913d1c796b1 (patch) | |
tree | 0ce810e93e01565e963597583b3fed5693995aa7 /lib/perl | |
parent | 41e4847786a68219263b7450573a4fce5c92672b (diff) | |
download | thrift-45c8e4935740292b8253041195ed5913d1c796b1.tar.gz |
THRIFT-3549 Exceptions are not properly stringified in Perl library
Patch: David Morel
Diffstat (limited to 'lib/perl')
-rw-r--r-- | lib/perl/lib/Thrift.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/perl/lib/Thrift.pm b/lib/perl/lib/Thrift.pm index 5cabd80d2..bd7b65a7d 100644 --- a/lib/perl/lib/Thrift.pm +++ b/lib/perl/lib/Thrift.pm @@ -60,6 +60,15 @@ use constant ONEWAY => 4; 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}; |