[ https://issues.apache.org/jira/browse/THRIFT-4819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Emmenlauer closed THRIFT-4819. ------------------------------------ Resolution: Cannot Reproduce I think this may be related to dynamic linking of Thrift, but I can not reproduce it right now. Closing as "Cannot reproduce". > All exceptions are TException > ----------------------------- > > Key: THRIFT-4819 > URL: https://issues.apache.org/jira/browse/THRIFT-4819 > Project: Thrift > Issue Type: Bug > Components: C++ - Library > Affects Versions: 0.13.0 > Reporter: Mario Emmenlauer > Priority: Major > > In recent versions of thrift we can not catch exceptions based on their IDL > type anymore. I'm not sure if we broke something, but the code is > sufficiently simple to suggest a bug in thrift. So here is what we have: > # A method with signature that can throw a specific exception, i.e. > UserException > # The C++ server throws this exception whenever the method is called > # The C++ client tries to catch this exception but it passes through > The client can catch the exception as `TException` or as `std::exception` and > we can see from the printed message `vException.what()` that its a > `UserException`. But catch does not deduce the type correctly. > Here is the part of the catch that does not work: > {code} > try { > vClient->SendRequest(); > } catch (const MyService::UserException& vEx) { > // Why is this not caught, when the server throws > MyService::UserException? > std::cerr << "Caught a UserException, message " << vEx.what() << > std::endl; > } catch (const std::exception& vEx) { > // Why is this one called instead? > std::cerr << "Caught a std::exception, message " << vEx.what() << > std::endl; > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)