Skip Menu |

This queue is for tickets about the Thrift CPAN distribution.

Report information
The Basics
Id: 86679
Status: resolved
Priority: 0/
Queue: Thrift

People
Owner: jking [...] cpan.org
Requestors: david.morel [...] amakuru.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.10.0



Subject: Unhelpful messages on errors
Here's a patch to solve the really unhelpful messages displayed on errors. Current behaviour: % test.pl TApplicationException=HASH(0x2f59760) (in cleanup) Thrift::TException=HASH(0x2f62d50) at /usr/local/perl/5.14.2/site/lib/Thrift/API/HiveClient2/TCLIService.pm line 3236. Patched: % perl -IThrift-0.9.0/lib test.pl TApplicationException error: Required field 'operationHandle' is unset! Struct:TFetchResultsReq(operationHandle:null, orientation:FETCH_NEXT, maxRows:1000000) (code 7) (in cleanup) Thrift::TException error: TSocket: timed out reading 4 bytes from hiveserver1:10000 (code 0) Patch: diff -ru Thrift-0.9.0.orig/lib/Thrift.pm Thrift-0.9.0/lib/Thrift.pm --- Thrift-0.9.0.orig/lib/Thrift.pm 2013-02-27 19:22:51.000000000 +0100 +++ Thrift-0.9.0/lib/Thrift.pm 2013-07-03 18:04:49.000000000 +0200 @@ -59,6 +59,17 @@ package Thrift::TException; +# An unclean workaround to have the multiple "die new TException" +# statements display something useful +use overload '""' => sub { + return + ref( $_[0] ) + . " error: " + . ( $_[0]->{message} || 'empty message' ) + . " (code " + . ( defined $_[0]->{code} ? $_[0]->{code} : 'undefined' ) . ")\n"; +}; + sub new { my $classname = shift; my $self = {message => shift, code => shift || 0};
Le Mer 03 Jui 2013 12:10:19, david.morel@amakuru.net a écrit : Show quoted text
> + . ( defined $_[0]->{code} ? $_[0]->{code} : 'undefined' ) . > ")\n";
I have mixed feeling about the newline. It makes output more readable but the line number goes away, maybe a full stack trace would be better anyway.
This was resolved in Thrift 0.10.0 based on the defect in the Apache Jira you entered: https://issues.apache.org/jira/browse/THRIFT-3549