You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/11/16 11:11:24 UTC

[GitHub] [rocketmq] SignUp-StealWheel opened a new issue #3494: 如何捕获在本地事务执行方法中抛出的异常?

SignUp-StealWheel opened a new issue #3494:
URL: https://github.com/apache/rocketmq/issues/3494


   如下图所示,本地事务执行过程中直接抛出一个RuntimeException。
   ![image](https://user-images.githubusercontent.com/31411237/141974025-db008b8a-55a2-4071-813b-aeb2ce61c30f.png)
   当异常发生后调用方无法捕获到抛出的异常,只接收到了TransactionSendResult,此时TransactionSendResult中的SendStatus为SEND_OK并且LocalTransactionState为UNKNOW,在TransactionSendResult类中没有找到任何和原始异常相关的信息,我应该如何捕获原始异常呢?
   如下图所示逻辑,我的目的是根据原始异常信息来判断给前端返回什么错误信息(例如:service逻辑中的某些参数限制条件不满足抛出的错误),但我只能做到如下图所示的逻辑,在不引入其他组件的前提下有什么好的实现方法吗?
   ![image](https://user-images.githubusercontent.com/31411237/141974714-3f4cff81-c848-4b7a-a189-3e7c6d729dea.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] Git-Yang commented on issue #3494: 如何捕获在本地事务执行方法中抛出的异常?

Posted by GitBox <gi...@apache.org>.
Git-Yang commented on issue #3494:
URL: https://github.com/apache/rocketmq/issues/3494#issuecomment-970201220


   Maybe you can catch the exception in executeLocalTransaction and put the information you want to get into the custom parameter arg.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] SignUp-StealWheel commented on issue #3494: 如何捕获在本地事务执行方法中抛出的异常?

Posted by GitBox <gi...@apache.org>.
SignUp-StealWheel commented on issue #3494:
URL: https://github.com/apache/rocketmq/issues/3494#issuecomment-970278666


   > Maybe you can catch the exception in executeLocalTransaction and put the information you want to get into the custom parameter arg.
   
   @Git-Yang Thanks for your answer! I was just thinking how to catch an Exception but i forgot to use the custom parameter arg.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] odbozhou closed issue #3494: 如何捕获在本地事务执行方法中抛出的异常?

Posted by GitBox <gi...@apache.org>.
odbozhou closed issue #3494:
URL: https://github.com/apache/rocketmq/issues/3494


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org