thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Emmenlauer (JIRA)" <>
Subject [jira] [Created] (THRIFT-4819) All exceptions are TException
Date Tue, 12 Mar 2019 16:21:00 GMT
Mario Emmenlauer created THRIFT-4819:

             Summary: All exceptions are TException
                 Key: THRIFT-4819
             Project: Thrift
          Issue Type: Bug
          Components: C++ - Library
    Affects Versions: 0.13.0
            Reporter: Mario Emmenlauer

In recent versions of thrift we can not exceptions based on their IDL type anymore. I'm not
sure if we broke something, but the code is sufficiently simple to suggest a but 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)
{        // TODO why is this not caught????????        std::cerr << "Caught a UserException"
<< vEx.what() << std::endl;    } catch (const std::exception& vEx) {     
  std::cerr << "Caught a std::exception, message " << vEx.what() << std::endl;

This message was sent by Atlassian JIRA

View raw message