File indexing completed on 2024-09-15 04:36:25

0001 /*
0002     SPDX-FileCopyrightText: 2015 Daniel Vrátil <dvratil@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 // krazy:excludeall=dpointer,inline
0008 
0009 #pragma once
0010 
0011 #include "akonadiprivate_export.h"
0012 
0013 #include <exception>
0014 #include <iostream>
0015 
0016 #include <QByteArray>
0017 
0018 namespace Akonadi
0019 {
0020 class AKONADIPRIVATE_EXPORT ProtocolException : public std::exception
0021 {
0022 public:
0023     explicit ProtocolException(const char *what)
0024         : std::exception()
0025         , mWhat(what)
0026     {
0027         std::cerr << "ProtocolException thrown:" << what << std::endl;
0028     }
0029 
0030     ProtocolException(const ProtocolException &) = delete;
0031     ProtocolException &operator=(const ProtocolException &) = delete;
0032 
0033     const char *what() const throw() override
0034     {
0035         return mWhat.constData();
0036     }
0037 
0038 private:
0039     QByteArray mWhat;
0040 };
0041 } // namespace Akonadi