7#include "exceptionbase.h"
15class Akonadi::ExceptionPrivate
18 explicit ExceptionPrivate(
const QByteArray &what)
27Exception::Exception(
const char *what)
30 d = std::make_unique<ExceptionPrivate>(
what);
38 d = std::make_unique<ExceptionPrivate>(
what);
46 d = std::make_unique<ExceptionPrivate>(
what.toUtf8());
57 static constexpr char mytype[] =
"Akonadi::Exception";
67 static constexpr char fallback[] =
"<some exception was thrown during construction: message lost>";
71 if (d->assembledWhat.isEmpty()) {
75 return "caught some exception while assembling Akonadi::Exception::what() return value";
78 return d->assembledWhat.constData();
81#define AKONADI_EXCEPTION_IMPLEMENT_TRIVIAL_INSTANCE(classname) \
82 Akonadi::classname::~classname() = default; \
83 QByteArray Akonadi::classname::type() const \
85 static constexpr char mytype[] = "Akonadi::" #classname; \
87 return QByteArray::fromRawData(mytype, sizeof(mytype) - 1); \
89 return QByteArray(); \
93AKONADI_EXCEPTION_IMPLEMENT_TRIVIAL_INSTANCE(PayloadException)
95#undef AKONADI_EXCEPTION_IMPLEMENT_TRIVIAL_INSTANCE
Base class for exceptions used by the Akonadi library.
virtual QByteArray type() const
Returns the type of this exception.
Exception(const char *what)
Creates a new exception with the error message what.
const char * what() const noexcept override
Returns the error message associated with this exception.
Helper integration between Akonadi and Qt.
QByteArray fromRawData(const char *data, qsizetype size)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:58 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.