thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald van Gorkum <>
Subject Re: Thrift custom exceptions C++
Date Wed, 19 Feb 2014 14:41:36 GMT
Hi Jens and Ben,

thanks for your reactions. I regenerated the cpp thrift code using 
Thrift 0.9.1 and the problem disappeared. As in the example from Ben I'm 
able to raise Exceptions and to catch them on the client side. Perhaps 
(but I have to reproduce the problem first again) it was because the 
inconsistent build environment with version 0.8 and 0.9.1.
Anyway, thanks for your help.



On 02/17/2014 09:51 PM, Jens Geyer wrote:
> Hi Ronald,
> In my opinion, the behaviour is correct, as there is no inheritance of 
> structural types with thrift, which includes exceptions. So the base 
> class message_ field is not used with your custom exceptions, because 
> it is not used :-) The string CTOR is solely (to be) used internally 
> at various places in the C++ library code.
> Have fun,
> JensG
> -----Urspr√ľngliche Nachricht----- From: Ronald van Gorkum
> Sent: Monday, February 17, 2014 9:17 AM
> To: thriftuser
> Subject: Thrift custom exceptions C++
> Hi all,
> I defined some custom exceptions in the Thrift IDL. From this IDL I
> generated C++ code. In the generated code the parent class (TException)
> is inherited, but the constructor isn't called. When I receive an
> exception I'm always receiving the default exception class instead of
> the desired custom exception class. If I look into the sources the
> parent class variable message_ is only set when the constructor of that
> class is being called with the name of the custom exception (what is not
> done in the generated code). Or, because the variable is protected, the
> content is changed by the custom exception class, but also therefore is
> no method generated. Who has also experiences with custom exceptions and
> raise them in C++ code and has a proper solution? Or is this a Thrift
> generator bug?
> Thanks.
> Ronald

View raw message