Skip to content
Snippets Groups Projects
Commit 8cf62208 authored by Jens Nolte's avatar Jens Nolte
Browse files

Add exception wrapper for esp_err_t

parent e5f3cb7c
No related branches found
No related tags found
1 merge request!16Merge dev branch into master
#include "error.hpp"
void qthing::errorCodeToException(esp_err_t errorNumber) {
if (errorNumber != ESP_OK) {
throw EspError(errorNumber);
}
}
#pragma once
#include <exception>
#include "esp_err.h"
// qthing public
namespace qthing {
class EspError : public std::exception {
public:
const esp_err_t errorNumber;
EspError(esp_err_t errorNumber) : errorNumber(errorNumber) {}
const char* what() const noexcept { return esp_err_to_name(errorNumber); }
};
void errorCodeToException(esp_err_t errorNumber);
} // namespace qthing
......@@ -2,6 +2,7 @@
#define QTHING_HIDE_PRIVATE_API
#include "error.hpp"
#include "network.hpp"
#include "power.hpp"
#include "qthing_legacy.hpp"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment