uber / tchannel-java

A Java implementation of the TChannel protocol.
MIT License
134 stars 67 forks source link

Propagate ErrorCode to caller if ProtocolError is thrown and wrapped by other exception #222

Closed tomliu4uber closed 4 years ago

tomliu4uber commented 4 years ago

When handlers work in async mode and throw a ProtocolError exception, the original ProtocolError exception may be wrapped by RuntimeException, ExecutionException or both.

So when RequestRouter catches an exception, it should check whether the exception is an instance of ProtocolError or the root cause of the exception is an instance of ProtocolError. If it is, the original error code and the message should be propagated back to the caller.

CLAassistant commented 4 years ago

CLA assistant check
All committers have signed the CLA.

codecov[bot] commented 4 years ago

Codecov Report

Merging #222 into master will increase coverage by 0.32%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #222      +/-   ##
============================================
+ Coverage     74.52%   74.84%   +0.32%     
  Complexity       11       11              
============================================
  Files            88       88              
  Lines          2916     2929      +13     
  Branches        372      375       +3     
============================================
+ Hits           2173     2192      +19     
+ Misses          513      506       -7     
- Partials        230      231       +1     
Impacted Files Coverage Δ Complexity Δ
...java/com/uber/tchannel/handlers/RequestRouter.java 79.03% <100.00%> (+2.46%) 0.00 <0.00> (ø)
...rc/main/java/com/uber/tchannel/api/SubChannel.java 76.92% <0.00%> (-0.96%) 0.00% <0.00%> (ø%)
.../main/java/com/uber/tchannel/errors/ErrorType.java 70.37% <0.00%> (+3.70%) 0.00% <0.00%> (ø%)
...java/com/uber/tchannel/errors/BadRequestError.java 75.00% <0.00%> (+75.00%) 0.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 82b3694...8a19020. Read the comment docs.