Astarte device API for C++ 0.7.1
Astarte device SDK for C++
Loading...
Searching...
No Matches
exceptions.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_EXCEPTIONS_H
6#define ASTARTE_DEVICE_SDK_EXCEPTIONS_H
7
12
13#include <exception>
14#include <string>
15#include <string_view>
16
17namespace AstarteDeviceSdk {
18
22class AstarteException : public std::exception {
23 public:
28 explicit AstarteException(std::string_view message);
33 [[nodiscard]] auto what() const noexcept -> const char* override;
34
35 private:
36 std::string message_;
37};
38
43 public:
48 explicit AstarteFileOpenException(std::string_view filename);
53 [[nodiscard]] auto get_filename() const -> const std::string&;
54
55 private:
56 std::string filename_;
57};
58
63 public:
68 explicit AstarteInvalidInputException(std::string_view err_message);
69};
70
75 public:
80 explicit AstarteInternalException(std::string_view err_message);
81};
82
87 public:
92 explicit AstarteOperationRefusedException(std::string_view err_message);
93};
94
95} // namespace AstarteDeviceSdk
96
97#endif // ASTARTE_DEVICE_SDK_EXCEPTIONS_H
AstarteException(std::string_view message)
Constructor for the Astarte exception.
auto what() const noexcept -> const char *override
Implementation of the virtual method what from the partent std::exception class.
auto get_filename() const -> const std::string &
Get the file name for the file which could not be opened.
AstarteFileOpenException(std::string_view filename)
Constructor for the Astarte file open exception.
AstarteInternalException(std::string_view err_message)
Constructor for the Astarte internal exception.
AstarteInvalidInputException(std::string_view err_message)
Constructor for the Astarte incompatible input exception.
AstarteOperationRefusedException(std::string_view err_message)
Constructor for the Astarte operation refused exception.
Umbrella namespace for the Astarte device SDK.
Definition data.hpp:22