blob: eba90e0bd4bde83a5154e44e3e19d9b65ee1b805 [file] [log] [blame]
Václav Kubernáte7a9fa32018-08-22 13:56:35 +02001/*
2 * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/
3 * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/
4 *
5 * Written by Václav Kubernát <kubervac@fit.cvut.cz>
6 *
7*/
8
9#include "datastore_access.hpp"
10
Václav Kubernátc58e4aa2019-04-03 18:37:32 +020011DatastoreError::DatastoreError(const std::string& message, const std::optional<std::string>& xpath)
12 : message(message)
13 , xpath(xpath)
14{
15}
16
Václav Kubernáte7a9fa32018-08-22 13:56:35 +020017DatastoreAccess::~DatastoreAccess() = default;
Václav Kubernátc58e4aa2019-04-03 18:37:32 +020018
19DatastoreException::DatastoreException(const std::vector<DatastoreError>& errors)
20{
21 m_what = "The following errors occured:\n";
22 for (const auto& it : errors) {
23 m_what += " Message: ";
24 m_what += it.message;
25 m_what += "\n";
26 if (it.xpath) {
Jan Kundrát88012592019-04-29 16:02:09 +020027 m_what += " XPath: ";
Václav Kubernátc58e4aa2019-04-03 18:37:32 +020028 m_what += it.xpath.value();
29 m_what += "\n";
30 }
31 }
32}
33
Václav Kubernátf5d75152020-12-03 03:52:34 +010034void DatastoreAccess::setTarget(const DatastoreTarget target)
35{
36 m_target = target;
37}
38
Václav Kubernátc58e4aa2019-04-03 18:37:32 +020039const char* DatastoreException::what() const noexcept
40{
41 return m_what.c_str();
42}