aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/exception.h
blob: 396b56f5d6fd0aa6cdb33ad29ac7eccc2e226a31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#ifndef EXCEPTION_H
#define EXCEPTION_H

#include <QtCore/QString>

#include <string>
#include <exception>

class Exception : public std::exception
{
public:
    explicit Exception(const QString &message) : m_message(message.toUtf8()) {}
    explicit Exception(const char *message) : m_message(message) {}

    const char *what() const noexcept override
    {
        return m_message.c_str();
    }

private:
    const std::string m_message;
};

#endif // EXCEPTION