| 1 | /* |
| 2 | * SPDX-FileCopyrightText: (C) 2019-2022 swift Project Community / Contributors (https://swift-project.org/) |
| 3 | * SPDX-FileCopyrightText: (C) 2019-2022 Lars Toenning <[email protected]> |
| 4 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #include <dbus/dbus.h> |
| 10 | #include <string> |
| 11 | |
| 12 | namespace flightgear::swift { |
| 13 | |
| 14 | //! DBus error |
| 15 | class CDBusError |
| 16 | { |
| 17 | public: |
| 18 | //! Error type |
| 19 | enum ErrorType { |
| 20 | NoError, |
| 21 | Other |
| 22 | }; |
| 23 | |
| 24 | //! Default constructor |
| 25 | CDBusError() = default; |
| 26 | |
| 27 | //! Constructor |
| 28 | explicit CDBusError(const DBusError* error); |
| 29 | |
| 30 | //! Get error type |
| 31 | ErrorType getType() const { return m_errorType; } |
| 32 | |
| 33 | private: |
| 34 | ErrorType m_errorType = NoError; |
| 35 | std::string m_name; |
| 36 | std::string m_message; |
| 37 | }; |
| 38 | |
| 39 | } // namespace flightgear::swift |