|
@@ -3,16 +3,29 @@
|
|
|
|
|
|
#include <exception>
|
|
|
#include <string>
|
|
|
+#include <utility>
|
|
|
|
|
|
#include <esp_err.h>
|
|
|
|
|
|
+class KBFError : public std::exception {
|
|
|
+public:
|
|
|
+ explicit KBFError(const std::string &message) : message("KBF error: " + message) {}
|
|
|
+
|
|
|
+ const std::string message;
|
|
|
+
|
|
|
+ [[nodiscard]] const char *what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT override {
|
|
|
+ return message.c_str();
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
class ESPError : public std::exception {
|
|
|
const esp_err_t err;
|
|
|
public:
|
|
|
explicit ESPError(const esp_err_t err) : err(err) {};
|
|
|
|
|
|
- [[nodiscard]] const char *
|
|
|
- what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT override { return esp_err_to_name(err); }
|
|
|
+ [[nodiscard]] const char *what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT override {
|
|
|
+ return esp_err_to_name(err);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
class RTOSError : public std::exception {
|
|
@@ -20,8 +33,9 @@ class RTOSError : public std::exception {
|
|
|
public:
|
|
|
explicit RTOSError(const uint32_t err) : message("RTOS error: " + std::to_string(err)) {};
|
|
|
|
|
|
- [[nodiscard]] const char *
|
|
|
- what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT override { return message.c_str(); }
|
|
|
+ [[nodiscard]] const char *what() const _GLIBCXX_TXN_SAFE_DYN _GLIBCXX_USE_NOEXCEPT override {
|
|
|
+ return message.c_str();
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
class OutOfMemoryError : public std::exception {
|