Open wiilei opened 5 months ago
Two handling tools for MultiException have been added to reduce the complexity of dealing with nested exceptions when constructing complex ParSeq flows.
allMultiCauses: Used to extract custom exceptions wrapped by MultiException, for example:
allMultiCauses
// Assuming both RPC and HTTP calls failed Task<?> rpcRespTask = Task.par<RpcA, RpcB>.map(...); Task<?> httpRespTask = Task.par<HttpA, HttpB>.map(...); Task<?> task = Task.par(rpcRespTask, httpRespTask) .onFailure(e -> // e: MultiException[MultiException[RpcAE, RpcBE], MultiException[HttpAE, HttpBE]] Collection<Throwable> es = Exceptions.allMultiCauses(e); // es: [RpcAE, RpcBE, HttpAE, HttpBE]
anyMultiCause: Used to retrieve any single actual exception from MultiException, for example:
anyMultiCause
xxx.onFailure(e -> // e: MultiException[MultiException[RpcAE, RpcBE], MultiException[HttpAE, HttpBE]] // print: 'com.linkedin.parseq.MultiException (multiple causes follow; only first is shown in stack trace): ...' Logger.error("has remote method error", e); // print: 'com.xxx.RpcException: Rpc A Error ...' Logger.error("has remote method error", Exceptions.anyMultiCause(e));
Two handling tools for MultiException have been added to reduce the complexity of dealing with nested exceptions when constructing complex ParSeq flows.
allMultiCauses
: Used to extract custom exceptions wrapped by MultiException, for example:anyMultiCause
: Used to retrieve any single actual exception from MultiException, for example: