The UserCanceled class.
This exception class is used to interrupt an action which was canceled by the user. This type of exception is useful if the exception catcher do not need to show a message box with the error message. For example, if a project is opened, the project's constructor will throw an exception in case of an error. Then the caller (the catcher of the exception) will show a message box with the error message. But the constructor can also throw an exception if the user has canceled opening the project (for example in a message box "restore project?" --> YES|NO|CANCEL). But then the error message box do not need to appear! So we can throw an exception of type "UserCanceled" to indicate that this was a user's decision and the catcher will not show an error message box.
- Note
- Normally, a UserCanceled exception do not need the attribute mMsg, so you do not need to pass the parameter "msg" to the constructor. This is because such an exception will never produce a message box with the error message (as there is not really an error - the user has simply canceled something).
- See also
- Exception