blob: 9ca931f0a46b72de80f85af862fe70b741185502 [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
34const char* DatastoreException::what() const noexcept
35{
36 return m_what.c_str();
37}