LibrePCB Developers Documentation
UserCanceled Class Referencefinal

The UserCanceled class. More...

#include <exceptions.h>

+ Inheritance diagram for UserCanceled:
+ Collaboration diagram for UserCanceled:

Public Member Functions

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

Detailed Description

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

Constructor & Destructor Documentation

◆ UserCanceled() [1/3]

UserCanceled ( )
delete

Default Constructor.

+ Here is the caller graph for this function:

◆ UserCanceled() [2/3]

UserCanceled ( const char *  file,
int  line,
const QString &  msg = QString("User Canceled") 
)
noexcept

The default constructor.

◆ UserCanceled() [3/3]

UserCanceled ( const UserCanceled other)
noexcept

The copy constructor (needed for clone())

Member Function Documentation

◆ raise()

virtual void raise ( ) const
inlineoverridevirtual

Reimplemented from Exception.

◆ clone()

virtual UserCanceled * clone ( ) const
inlineoverridevirtual

Reimplemented from Exception.

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: