|
| UserCanceled ()=delete |
| Default Constructor.
|
|
| UserCanceled (const char *file, int line, const QString &msg=QString("User Canceled")) noexcept |
| The default constructor.
|
|
| UserCanceled (const UserCanceled &other) noexcept |
| The copy constructor (needed for clone())
|
|
virtual void | raise () const override |
|
virtual UserCanceled * | clone () const override |
|
| Exception ()=delete |
| The default constructor.
|
|
| Exception (const Exception &other) noexcept |
| The copy constructor (needed for clone())
|
|
| Exception (const char *file, int line, const QString &msg=QString("Exception")) noexcept |
| The constructor which is used to throw an exception.
|
|
virtual | ~Exception () noexcept |
| The destructor.
|
|
const QString & | getMsg () const |
| Get the error message (translated)
|
|
const QString & | getFile () const |
| Get the source file where the exception was thrown.
|
|
int | getLine () const |
| Get the line number where the exception was thrown.
|
|
const char * | what () const noexcept override |
| reimplemented from std::exception::what()
|
|
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