2

What is the notation for an Exception Handler in UML activity diagrams? Is it just the lightning bolt? Or more than that?

According to the specification v2.5.1 page 404:

An ExceptionHandler is shown by drawing a “lightning bolt” symbol from the boundary of the protectedNode to a small square on the boundary of the ExceptionHandler.

To me, this sounds like a recursive explanation.

According to the abstract syntax (page 403), exception handlers are part of their protected node and are associated to the handlerBody (ExecutableNode), the exceptionInput (ObjectNode), and to exceptionTypes (Classifier).

My understanding is, that the exception handler is just the lighning bolt. The handlerBody, its objectNode, and the protectedNode are separate entities using their own notation.

Is someone able to clarify this?

muued
  • 1,666
  • 13
  • 25
  • You can send bug reports to OMG. I did so in the past. Unlike Sparx you can see the list of bugs. But like Sparx the progress in working on them seems to be a limes->0 – qwerty_so May 07 '20 at 08:47

3 Answers3

4

The wording in the specs is sometimes confusing. The lightning is an InterruptFlow and the handler is an ExecutableNode. There are quite some examples in the specs (pp. 403 of UML 2.5)

You need four things to show exception handling in an AD:

enter image description here

  • Some Action (I left out control flows from/to other actions)
  • An InterruptibleActivityRegion (the dashed boundary)
  • An ExceptionHandler with a ObjectNode to accept an exception
  • And the InterruptFlow (shown by the bolt)

You can only have the bolt go out of the interruptible region. And like usual object flows you can attach guards to that bolt.

In order to show details of the exception handling you can place call behavior inside the handler.

To specify exception types you can do it as shown in the specs on p. 403 of UML 2.5:

enter image description here

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
  • Your picture and wording suggest you are using Enterprise Architect, which is exactly the source of my confusion, since the concepts don't seem to match the specification. The `InterruptFlow` in the context of an `InterruptibleActivityRegion` matches its `interruptingEdge` property (which still is typed `ActivityEdge`), but doesn't belong seem to necessarily belong to Exception Handlers. If the Exception Handler is the node labeled `ExceptionHandler1`, then how do you specify the `handlerBody`? Where do you specify the exception types? – muued May 06 '20 at 14:07
  • ExceptionHandler has the input pin to which the interruptingEdge goes and the type of exception is passed there. I am writing from memory though. – Ister May 06 '20 at 14:20
  • 1
    The ExceptionHandler is an ExecutableNode. Right above in chap. 15.5 – qwerty_so May 06 '20 at 15:39
  • I can't find this piece of information in the current version (v2.5.1). According to section 15.7.13.3, ExceptionHandler is a specialization of Element. The only specialization of ExecutableNode ist Action, see 15.7.14.4 – muued May 11 '20 at 11:06
  • Which piece? The last image? It's 2 pages further in 2.5.1. – qwerty_so May 11 '20 at 12:34
  • I can't find the information that "The ExceptionHandler is an ExecutableNode." – muued May 19 '20 at 13:35
  • Oh wait, you are back from holydays? Did you read my comment? – qwerty_so May 19 '20 at 15:53
2

You are right the Abstract Syntax seems more clear than the description for me.

Exception Handler might be see like an edge. It is owned by its source, aka the protectedNode for the Exception Handler, and referring its target, aka the exceptionInput (owned by the handlerBody) in the Exception Handler case.

Of course in most of the case the protectedNode and handlerBody are two differents Executable Node with their own notation (Structured Activity, Action ,etc. ).

Last point is the exceptionType Classifier which is a reference to any Classifier on your model.

Hoping it clarifies things. EBR

Red Beard
  • 3,436
  • 1
  • 14
  • 17
1

You are right - ExceptionHandler is a lightning bolt.

According to the Abstract Syntax diagram below, ExceptionHandler is an Element that represents a relationship between four other instances: ExecutableNode (protectedNode), ExecutableNode (handlerBody), ObjectNode (exceptionInput) and Classifier (exceptionType)

enter image description here

So the documentation is mostly precise (with my minor modification - I replaced the second ExceptionHandler with handlerBody):

The notation for ExceptionHandlers is illustrated in Figure 15.62. An ExceptionHandler is shown by drawing a “lightning bolt” symbol from the boundary of the protectedNode to a small square on the boundary of the handlerBody. The name of the exceptionType is placed next to the lightning bolt. The small square is the exceptionInput node.

enter image description here

zer0hedge
  • 449
  • 3
  • 12