Astarte device API for C++ 0.8.1
Astarte device SDK for C++
Loading...
Searching...
No Matches
errors.hpp
Go to the documentation of this file.
1// (C) Copyright 2025, SECO Mind Srl
2//
3// SPDX-License-Identifier: Apache-2.0
4
5#ifndef ASTARTE_DEVICE_SDK_MQTT_ERRORS_H
6#define ASTARTE_DEVICE_SDK_MQTT_ERRORS_H
7
16
17#include <memory>
18#include <optional>
19#include <string>
20#include <variant>
21
22// We accept this circular inclusion as it's required for this file to be included without the
23// generic errors header file (and vice-versa).
24// NOLINTNEXTLINE(misc-header-include-cycle)
26
27namespace astarte::device::mqtt {
28
30class MqttError : public ErrorBase {
31 public:
36 explicit MqttError(std::string_view message);
37
39 explicit MqttError();
40
46 explicit MqttError(std::string_view message, const Error& other);
47
52 explicit MqttError(const Error& other);
53
54 private:
55 static constexpr std::string_view k_type_ = "MqttError";
56};
57
59class PairingApiError : public ErrorBase {
60 public:
65 explicit PairingApiError(std::string_view message);
66
72 explicit PairingApiError(std::string_view message, const Error& other);
73
74 private:
75 static constexpr std::string_view k_type_ = "PairingApiError";
76};
77
79class InvalidUrlError : public ErrorBase {
80 public:
85 explicit InvalidUrlError(std::string_view message);
86
92 explicit InvalidUrlError(std::string_view message, const Error& other);
93
94 private:
95 static constexpr std::string_view k_type_ = "InvalidUrlError";
96};
97
100 public:
105 explicit DeviceRegistrationError(std::string_view message);
106
112 explicit DeviceRegistrationError(std::string_view message, const Error& other);
113
114 private:
115 static constexpr std::string_view k_type_ = "DeviceRegistrationError";
116};
117
120 public:
125 explicit JsonParsingError(std::string_view message);
126
132 explicit JsonParsingError(std::string_view message, const Error& other);
133
134 private:
135 static constexpr std::string_view k_type_ = "JsonParsingError";
136};
137
140 public:
145 explicit RetrieveBrokerUrlError(std::string_view message);
146
152 explicit RetrieveBrokerUrlError(std::string_view message, const Error& other);
153
154 private:
155 static constexpr std::string_view k_type_ = "RetrieveBrokerUrlError";
156};
157
160 public:
165 explicit ReadCredentialError(std::string_view message);
166
172 explicit ReadCredentialError(std::string_view message, const Error& other);
173
174 private:
175 static constexpr std::string_view k_type_ = "ReadCredentialError";
176};
177
180 public:
185 explicit WriteCredentialError(std::string_view message);
186
192 explicit WriteCredentialError(std::string_view message, const Error& other);
193
194 private:
195 static constexpr std::string_view k_type_ = "WriteCredentialError";
196};
197
200 public:
205 explicit PairingConfigError(std::string_view message);
206
212 explicit PairingConfigError(std::string_view message, const Error& other);
213
214 private:
215 static constexpr std::string_view k_type_ = "PairingConfigError";
216};
217
219class CryptoError : public ErrorBase {
220 public:
225 explicit CryptoError(std::string_view message);
226
232 explicit CryptoError(std::string_view message, const Error& other);
233
234 private:
235 static constexpr std::string_view k_type_ = "CryptoError";
236};
237
239class UuidError : public ErrorBase {
240 public:
245 explicit UuidError(std::string_view message);
246
252 explicit UuidError(std::string_view message, const Error& other);
253
254 private:
255 static constexpr std::string_view k_type_ = "UuidError";
256};
257
259class HttpError : public ErrorBase {
260 public:
265 explicit HttpError(std::string_view message);
266
272 explicit HttpError(std::string_view message, const Error& other);
273
274 private:
275 static constexpr std::string_view k_type_ = "HttpError";
276};
277
280 public:
285 explicit MqttConnectionError(std::string_view message);
286
292 explicit MqttConnectionError(std::string_view message, const Error& other);
293
294 private:
295 static constexpr std::string_view k_type_ = "MqttConnectionError";
296};
297
298} // namespace astarte::device::mqtt
299
300#endif // ASTARTE_DEVICE_SDK_MQTT_ERRORS_H
auto message() const -> const std::string &
Retrieves the error message.
ErrorBase(const ErrorBase &)=default
Default copy constructor.
CryptoError(std::string_view message, const Error &other)
Nested error constructor.
CryptoError(std::string_view message)
Standard error constructor.
DeviceRegistrationError(std::string_view message)
Standard error constructor.
DeviceRegistrationError(std::string_view message, const Error &other)
Nested error constructor.
HttpError(std::string_view message, const Error &other)
Nested error constructor.
HttpError(std::string_view message)
Standard error constructor.
InvalidUrlError(std::string_view message)
Standard error constructor.
InvalidUrlError(std::string_view message, const Error &other)
Nested error constructor.
JsonParsingError(std::string_view message, const Error &other)
Nested error constructor.
JsonParsingError(std::string_view message)
Standard error constructor.
MqttConnectionError(std::string_view message)
Standard error constructor.
MqttConnectionError(std::string_view message, const Error &other)
Nested error constructor.
MqttError()
Error constructor with no message.
MqttError(std::string_view message)
Standard error constructor.
MqttError(const Error &other)
Nested error constructor with no message.
MqttError(std::string_view message, const Error &other)
Nested error constructor.
PairingApiError(std::string_view message, const Error &other)
Nested error constructor.
PairingApiError(std::string_view message)
Standard error constructor.
PairingConfigError(std::string_view message)
Standard error constructor.
PairingConfigError(std::string_view message, const Error &other)
Nested error constructor.
ReadCredentialError(std::string_view message)
Standard error constructor.
ReadCredentialError(std::string_view message, const Error &other)
Nested error constructor.
RetrieveBrokerUrlError(std::string_view message, const Error &other)
Nested error constructor.
RetrieveBrokerUrlError(std::string_view message)
Standard error constructor.
UuidError(std::string_view message, const Error &other)
Nested error constructor.
UuidError(std::string_view message)
Standard error constructor.
WriteCredentialError(std::string_view message, const Error &other)
Nested error constructor.
WriteCredentialError(std::string_view message)
Standard error constructor.
Error types and handling for the Astarte device library.
Namespace for Astarte device functionality using the MQTT transport protocol.
Definition errors.hpp:57
std::variant< DataSerializationError, InternalError, FileOpenError, InvalidInputError, InterfaceValidationError, InvalidInterfaceVersionError, InvalidInterfaceTypeError, InvalidInterfaceOwnershipeError, InvalidInterfaceAggregationError, InvalidAstarteTypeError, InvalidReliabilityError, InvalidRetentionError, InvalidDatabaseRetentionPolicyError, OperationRefusedError, GrpcLibError, MsgHubError, mqtt::JsonParsingError, mqtt::DeviceRegistrationError, mqtt::PairingApiError, mqtt::MqttError, mqtt::InvalidUrlError, mqtt::RetrieveBrokerUrlError, mqtt::ReadCredentialError, mqtt::WriteCredentialError, mqtt::PairingConfigError, mqtt::CryptoError, mqtt::UuidError, mqtt::HttpError, mqtt::MqttConnectionError > Error
Variant type representing any error from the Astarte device library.
Definition errors.hpp:80