gpt4 book ai didi

uml - 不确定 UML 2.0 Activity Diagram 中的异常处理

转载 作者:行者123 更新时间:2023-12-04 15:27:08 25 4
gpt4 key购买 nike

你好,
我最近正在将某个项目反向工程到 UML,并且卡在了无法得出结论的地步。代码相当简单:

            ...
try
{
sj = SendingJob.DeserializeXmlString("....");
trcSrc.TraceInfo("....");
}
catch (FormatException)
{
trcSrc.TraceError("....");

return "00 - Job Content Bad Format.";
} ...

首先,我对代码进行了建模:

alt text

但在阅读以下文字后:

"If an exception occurs while an action is executing, the execution is abandoned and there is no output from the action. If the action has an exception handler, the handler is executed with the exception information. When the exception handler executes, its output is available to the next action after the protected node, as though the protected node had finished execution."



...但问题是我的异常处理程序通过返回一个值并停止事件来退出 catch 块。我试图将异常节点链接到事件最终节点,但我的工具拒绝这样做,而且我很确定这不是正确的方法。

所以我的问题是:
如何建模一个事件图,其中一个 Action 引发异常,其处理程序终止该事件?

最佳答案

由于我不允许发布图片,但我会尝试描述我的解决方案:)
在您的异常处理程序中,包含一个表示其功能的操作。然后,您可以将该操作链接到事件图的终止节点。

关于uml - 不确定 UML 2.0 Activity Diagram 中的异常处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4678142/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com