[
https://issues.apache.org/jira/browse/THRIFT-4819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mario Emmenlauer updated THRIFT-4819:
-------------------------------------
Description:
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 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) {
// 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;
}
{code}
was:
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:
{code}
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;
}
{code}
> 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 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) {
> // 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;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)