blob: e421274ba28f5820e71ebf2f4d24aa9243ace72d [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áte066fe22022-04-06 00:32:26 +020034DatastoreTarget DatastoreAccess::target() const
35{
36 return m_target;
37}
38
Václav Kubernátf5d75152020-12-03 03:52:34 +010039void DatastoreAccess::setTarget(const DatastoreTarget target)
40{
41 m_target = target;
42}
43
Václav Kubernátc58e4aa2019-04-03 18:37:32 +020044const char* DatastoreException::what() const noexcept
45{
46 return m_what.c_str();
47}