File indexing completed on 2024-05-26 05:09:43

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Romain Bignon <romain@symlink.me>
0003     SPDX-FileCopyrightText: 2014-2015 Florent Fourcot <weboob@flo.fourcot.fr>
0004     SPDX-FileCopyrightText: 2017 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef WOOBEXC_H
0009 #define WOOBEXC_H
0010 
0011 // ----------------------------------------------------------------------------
0012 // QT Includes
0013 
0014 #include <QException>
0015 
0016 // ----------------------------------------------------------------------------
0017 // KDE Includes
0018 
0019 // ----------------------------------------------------------------------------
0020 // Project Includes
0021 
0022 enum class ExceptionCode {
0023     BrowserIncorrectPassword,
0024 };
0025 
0026 class WoobException : public QException
0027 {
0028 public:
0029     explicit WoobException(ExceptionCode ec)
0030         : m_exceptionCode(ec)
0031     {
0032     }
0033     ExceptionCode msg() const
0034     {
0035         return m_exceptionCode;
0036     }
0037     void raise() const override
0038     {
0039         throw *this;
0040     }
0041     WoobException* clone() const override
0042     {
0043         return new WoobException(*this);
0044     }
0045     ExceptionCode m_exceptionCode;
0046 };
0047 #endif