File indexing completed on 2024-03-24 04:08:16

0001 /*
0002     SPDX-FileCopyrightText: 2015 Jakob Gruber <jakob.gruber@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SYSTEMEXCEPTION_H
0008 #define SYSTEMEXCEPTION_H
0009 
0010 #include <QString>
0011 #include <exception>
0012 
0013 class SystemException : public std::exception
0014 {
0015 public:
0016     SystemException() { m_msg = QStringLiteral("system error"); }
0017     SystemException(const QString &msg) { m_msg = msg; }
0018 
0019     ~SystemException() throw() override { }
0020 
0021     const char *what() const throw() override {
0022         return m_msg.toLatin1().constData();
0023     }
0024 
0025 private:
0026     QString m_msg;
0027 };
0028 
0029 #endif // SYSTEMEXCEPTION_H