File indexing completed on 2024-11-24 03:56:29

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <stdexcept>
0010 #include <QString>
0011 
0012 namespace app {
0013 
0014 template<class Base=std::runtime_error>
0015 class QStringException : public Base
0016 {
0017 protected:
0018     using Ctor = QStringException;
0019 
0020 public:
0021     QStringException(const QString& what) : Base(what.toStdString()) {}
0022 
0023     QString message() const
0024     {
0025         return QString(this->what());
0026     }
0027 };
0028 
0029 } // namespace app