QtDataSync  4.2.0
A simple offline-first synchronisation framework, to synchronize data of Qt applications between devices
exception.h
1 #ifndef QTDATASYNC_EXCEPTION_H
2 #define QTDATASYNC_EXCEPTION_H
3 
4 #include <QtCore/qexception.h>
5 
6 #include "QtDataSync/qtdatasync_global.h"
7 
8 namespace QtDataSync {
9 
10 class Defaults;
11 
13 class Q_DATASYNC_EXPORT Exception : public QException
14 {
15 public:
17  Exception(const QString &setupName, const QString &message);
19  Exception(const Defaults &defaults, const QString &message);
20 
22  virtual QByteArray className() const noexcept;
24  QString setupName() const;
26  QString message() const;
27 
29  virtual QString qWhat() const;
31  virtual const char *what() const noexcept final; //mark virtual again for doxygen
32 
34  virtual void raise() const override; //mark virtual again for doxygen
36  virtual QException *clone() const override; //mark virtual again for doxygen
37 
38 protected:
40  Exception(const Exception * const other);
41 
43  QString _setupName;
45  QString _message;
47  mutable QByteArray _qWhat;
48 };
49 
51 class Q_DATASYNC_EXPORT SetupDoesNotExistException : public Exception
52 {
53 public:
55  SetupDoesNotExistException(const QString &setupName);
56 
57  QByteArray className() const noexcept override;
58  void raise() const override;
59  QException *clone() const override;
60 
61 protected:
64 };
65 
66 }
67 
69 #define __QTDATASYNC_EXCEPTION_NAME_IMPL(x) #x
70 #define QTDATASYNC_EXCEPTION_NAME(x) "QtDataSync::" __QTDATASYNC_EXCEPTION_NAME_IMPL(x)
72 
73 #endif // QTDATASYNC_EXCEPTION_H
The base class for all exceptions of QtDataSync.
Definition: exception.h:13
An Exception thrown in case a class is trying to access a setup that does not exist.
Definition: exception.h:51
The primary namespace of the QtDataSync library.
A helper class to get defaults per datasync instance (threadsafe)
Definition: defaults.h:61