Line data Source code
1 : // SPDX-FileCopyrightText: 2026 PairInteraction Developers 2 : // SPDX-License-Identifier: LGPL-3.0-or-later 3 : 4 : #pragma once 5 : 6 : #include <memory> 7 : #include <stdexcept> 8 : #include <utility> 9 : #include <vector> 10 : 11 : namespace pairinteraction { 12 : class KetAtom; 13 : 14 : /** 15 : * @class KetNotUniqueError 16 : * 17 : * @brief Exception thrown when a ket is not uniquely specified. 18 : * 19 : * The exception carries the candidate kets that match the description so that the caller (e.g. the 20 : * Python bindings) can format a helpful error message using its own labeling logic. 21 : */ 22 : class KetNotUniqueError : public std::runtime_error { 23 : public: 24 1 : explicit KetNotUniqueError(std::vector<std::shared_ptr<const KetAtom>> kets) 25 1 : : std::runtime_error("The ket is not uniquely specified."), kets(std::move(kets)) {} 26 : 27 0 : const std::vector<std::shared_ptr<const KetAtom>> &get_kets() const { return kets; } 28 : 29 : private: 30 : std::vector<std::shared_ptr<const KetAtom>> kets; 31 : }; 32 : 33 : } // namespace pairinteraction