You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and notice that they do not set the ResponseCode. It seems to make sense. I suspect the ResponseCode is something that is set by tchannel (in case of an uncaught exception or network error) but just want to confirm.
@siddjain, yes, the handler must set the response code for non-successful result responses.
result.setSuccess(...);
ThriftReponse response = new ThriftResponse
.Builder<some_result>(request)
.setResponseCode(ResponseCode.OK) // this is the default (so can be skipped; i don't)
.setBody(result)
.build();
result.setMyDeclaredException(...);
ThriftResponse response = new ThriftResponse
.Builder<some_result>(request)
.setResponseCode(ResponseCode.Error)
.setBody(result)
.build();
Activity
prashantv commentedon Aug 25, 2017
If you trace through the builders used to create the Thrift response, you'll see it ends up at
Response, which has a default value ofOK:https://github.com/uber/tchannel-java/blob/master/tchannel-core/src/main/java/com/uber/tchannel/messages/Response.java#L250
siddjain commentedon Aug 25, 2017
this does not address the question. please re-read the question to understand what it is asking.
yborovikov commentedon Nov 22, 2017
@siddjain, yes, the handler must set the response code for non-successful result responses.