[ 
https://issues.apache.org/jira/browse/THRIFT-4852?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yu Gan updated THRIFT-4852:
---------------------------
    Summary: The recv function of void functions doesn't throw custom 
exceptions  (was: The recv function of void functions don't throw custom 
exceptions)

> The recv function of void functions doesn't throw custom exceptions
> -------------------------------------------------------------------
>
>                 Key: THRIFT-4852
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4852
>             Project: Thrift
>          Issue Type: Bug
>          Components: Lua - Compiler
>    Affects Versions: 0.12.0
>            Reporter: Yu Gan
>            Priority: Major
>
> In thrift/compiler/cpp/src/thrift/generate/t_lua_generator.cc:621, it only 
> throws custom exceptions when the function is not void. However, void 
> function could still return exceptions to the caller service, as long as the 
> function is not oneway.
> {code}
> // Return the result if it's not a void function
>       if (!(*f_iter)->get_returntype()->is_void()) {
>         out << indent() << "if result.success ~= nil then" << endl << 
> indent() << "  return result.success"
>             << endl;
>         // Throw custom exceptions
>         const std::vector<t_field*>& xf = 
> (*f_iter)->get_xceptions()->get_members();
>         vector<t_field*>::const_iterator x_iter;
>         for (x_iter = xf.begin(); x_iter != xf.end(); ++x_iter) {
>           out << indent() << "elseif result." << (*x_iter)->get_name() << " 
> then" << endl
>               << indent() << "  error(result." << (*x_iter)->get_name() << 
> ")" << endl;
>         }
>         out << indent() << "end" << endl << indent()
>             << "error(TApplicationException:new{errorCode = "
>             << "TApplicationException.MISSING_RESULT})" << endl;
>       }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to