Václav Kubernát | e7a9fa3 | 2018-08-22 13:56:35 +0200 | [diff] [blame] | 1 | /* |
| 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át | c58e4aa | 2019-04-03 18:37:32 +0200 | [diff] [blame] | 11 | DatastoreError::DatastoreError(const std::string& message, const std::optional<std::string>& xpath) |
| 12 | : message(message) |
| 13 | , xpath(xpath) |
| 14 | { |
| 15 | } |
| 16 | |
Václav Kubernát | e7a9fa3 | 2018-08-22 13:56:35 +0200 | [diff] [blame] | 17 | DatastoreAccess::~DatastoreAccess() = default; |
Václav Kubernát | c58e4aa | 2019-04-03 18:37:32 +0200 | [diff] [blame] | 18 | |
| 19 | DatastoreException::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át | 8801259 | 2019-04-29 16:02:09 +0200 | [diff] [blame] | 27 | m_what += " XPath: "; |
Václav Kubernát | c58e4aa | 2019-04-03 18:37:32 +0200 | [diff] [blame] | 28 | m_what += it.xpath.value(); |
| 29 | m_what += "\n"; |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
Václav Kubernát | e066fe2 | 2022-04-06 00:32:26 +0200 | [diff] [blame] | 34 | DatastoreTarget DatastoreAccess::target() const |
| 35 | { |
| 36 | return m_target; |
| 37 | } |
| 38 | |
Václav Kubernát | f5d7515 | 2020-12-03 03:52:34 +0100 | [diff] [blame] | 39 | void DatastoreAccess::setTarget(const DatastoreTarget target) |
| 40 | { |
| 41 | m_target = target; |
| 42 | } |
| 43 | |
Václav Kubernát | c58e4aa | 2019-04-03 18:37:32 +0200 | [diff] [blame] | 44 | const char* DatastoreException::what() const noexcept |
| 45 | { |
| 46 | return m_what.c_str(); |
| 47 | } |