Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
0.13.0
-
None
-
None
Description
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:
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; }