aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/exception.h
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken6/ApiExtractor/exception.h')
-rw-r--r--sources/shiboken6/ApiExtractor/exception.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/exception.h b/sources/shiboken6/ApiExtractor/exception.h
new file mode 100644
index 000000000..396b56f5d
--- /dev/null
+++ b/sources/shiboken6/ApiExtractor/exception.h
@@ -0,0 +1,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