HI, I recently was reverse engineering a certain project to UML, and was stuck at a point where I could not reach a conclusion. The code is fairly simple:
...
try
{
sj = SendingJob.DeserializeXmlString("....");
trcSrc.TraceInfo("....");
}
catch (FormatException)
{
trcSrc.TraceError("....");
return "00 - Job Content Bad Format.";
} ...
Firts off I modeled the code as such:
But after reading the following 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."
... but the thing is my exception handler exits the catch block by returning a value, and stopping the activity. I tried to link the exception node to an activity final node, but my tool refuses to do it, and which I'm pretty sure is not the correct way to do it.
So my question is: How to model an activity diagram where an action throws an exception and its handler terminates the activity?
Exception Handlers can be modelled on activity diagrams as in the example below.
In the UML, an exception is a specialization of a signal, which is the specification of an asynchronous communication between objects. This means that in interaction diagrams, exceptions are illustrated as asynchronous messages.
As I am not allowed to post images yet I'll try to describe my solution :) In your exception handler, include an action that represents what it does. You can then link that action to the termination node of the activity diagram.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With