Add sysrepo error handling
Change-Id: I810de1afd0ad6161a18903f816e19db28ed9edf1
diff --git a/src/datastore_access.hpp b/src/datastore_access.hpp
index 2f75e51..67b3d29 100644
--- a/src/datastore_access.hpp
+++ b/src/datastore_access.hpp
@@ -9,6 +9,7 @@
#pragma once
#include <map>
+#include <optional>
#include <string>
#include "ast_values.hpp"
@@ -16,6 +17,22 @@
* \brief Abstract class for accessing a datastore
*/
+struct DatastoreError {
+ std::string message;
+ std::optional<std::string> xpath;
+
+ DatastoreError(const std::string& message, const std::optional<std::string>& xpath);
+};
+
+class DatastoreException : std::exception {
+public:
+ DatastoreException(const std::vector<DatastoreError>& errors);
+ ~DatastoreException() override = default;
+ const char* what() const noexcept override;
+
+private:
+ std::string m_what;
+};
class DatastoreAccess {
public: