const Declaration& decl) {
const char setter[] = "$$($$, $$);\n";
std::string str;
- if (decl.GetMethodType() != Declaration::MethodType::SYNC)
+ if (decl.GetMethodType() != Declaration::MethodType::SYNC) {
+ str += "set_last_result(r);" + NLine(1);
return str;
+ }
str += GenTemplateString(CB_RECEIVE_BLOCK,
[&]()->std::string {
std::string s;
return s;
});
if (GetReturnTypeString(decl.GetType()) != "void ") {
+ str += "set_last_result(r);" + NLine(1);
str += NLine(1);
str += "return ret;";
}
$$rpc_port_proxy_##_invoke_$$(rpc_port_proxy_##_h h$$)
{
rpc_port_parcel_h parcel;
+ int r;
$$
if (!h$$) {
rpc_port_parcel_create(&parcel);
rpc_port_parcel_write_int32(parcel, ##_METHOD_$$);
$$
- rpc_port_parcel_send(parcel, h->port);
+ r = rpc_port_parcel_send(parcel, h->port);
+ if (r != RPC_PORT_ERROR_NONE) {
+ _E("Failed to send parcel. result(%d)", r);
+ r = RPC_PORT_ERROR_IO_ERROR;
+ }
+
rpc_port_parcel_destroy(parcel);
$$
}
const char CB_INVOCATION_MID[] =
R"__cpp_cb(
// Send
- rpc_port_parcel_send(p, port_);
+ int r = rpc_port_parcel_send(p, port_);
+ if (r != RPC_PORT_ERROR_NONE) {
+ _E("Failed to send parcel. result(%d)", r);
+ rpc_port_parcel_destroy(p);
+ throw InvalidIOException();
+ }
)__cpp_cb";
const char CB_INVOCATION_RECEIVE[] =