Search code examples
javaexceptionumlsequence-diagram

How to handle an exception thrown by an actor i.e. cancelOperation() in sequence diagram?


I'm making a sequence diagram for some use cases of an interaction model for an online Book Store. In the use case sequence diagram, there's always the possibility of a user canceling the process that is occurring like on a normal site by logging out, by pressing cancel on an operation, or simply closing the browser or app. How do I model this in the sequence diagram? This is what I currently have:

enter image description here

I've tried putting in an alt fragment, but it would have to encompass the lifelines and I don't think its right because it depends on where the user executes cancel. I've thought of using break, but that assumes where the person is going to cancel. Since this applies to all use-cases I'm not sure how to model cancellation during execution of a process or use-case.


Solution

  • A SD focuses on a certain scenario in detail. That means it's not so meaningful for general cases. So your choice is to either have a note in a "general" SD or to create individual SDs to show behavior (e.g. for time-out, for cancel, for erroneous entry etc.)