| 119 | } |
| 120 | |
| 121 | void RpcContext::RespondApplicationError(int error_ext_id, const std::string& message, |
| 122 | const Message& app_error_pb) { |
| 123 | if (AreResultsTracked()) { |
| 124 | result_tracker_->FailAndRespond(call_->header().request_id(), |
| 125 | error_ext_id, message, app_error_pb); |
| 126 | } else { |
| 127 | if (VLOG_IS_ON(4)) { |
| 128 | ErrorStatusPB err; |
| 129 | InboundCall::ApplicationErrorToPB(error_ext_id, message, app_error_pb, &err); |
| 130 | VLOG(4) << call_->remote_method().service_name() |
| 131 | << ": Sending application error response for " << call_->ToString() |
| 132 | << ":" << std::endl << SecureDebugString(err); |
| 133 | } |
| 134 | TRACE_EVENT_ASYNC_END2("rpc_call", "RPC", this, |
| 135 | "response", pb_util::PbTracer::TracePb(app_error_pb), |
| 136 | "trace", trace()->DumpToString()); |
| 137 | call_->RespondApplicationError(error_ext_id, message, app_error_pb); |
| 138 | delete this; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | const rpc::RequestIdPB* RpcContext::request_id() const { |
| 143 | return call_->header().has_request_id() ? &call_->header().request_id() : nullptr; |