fourdst::libcomposition v2.2.1 Robust atomic species information library

Loading...
Searching...
No Matches
exceptions_composition.h
Go to the documentation of this file.
1#pragma once
2
3#include <exception>
4#include <string>
5
6 namespace fourdst::composition::exceptions {
14 class CompositionError : public std::exception {
15 protected:
19 std::string m_message;
20 public:
25 explicit CompositionError(const std::string& message)
26 : m_message(std::move(message)) {}
27
32 const char* what() const noexcept override{
33 return m_message.c_str();
34 }
35 };
36
41 class InvalidCompositionError final : public CompositionError {
42 using CompositionError::CompositionError;
43 };
44
51 class UnregisteredSymbolError final : public CompositionError {
52 using CompositionError::CompositionError;
53 };
54
59 class SpeciesError : public std::exception {
60 protected:
61 std::string m_message;
62 public:
63 explicit SpeciesError(const std::string& message)
64 : m_message(std::move(message)) {}
65
66 const char* what() const noexcept override {
67 return m_message.c_str();
68 }
69 };
70
77 class UnknownSymbolError final : public SpeciesError {
78 using SpeciesError::SpeciesError;
79 };
80
81}
fourdst::composition::exceptions::CompositionError
Base class for exceptions related to composition objects.
Definition exceptions_composition.h:14
fourdst::composition::exceptions::CompositionError::m_message
std::string m_message
The error message.
Definition exceptions_composition.h:19
fourdst::composition::exceptions::CompositionError::what
const char * what() const noexcept override
Returns the error message.
Definition exceptions_composition.h:32
fourdst::composition::exceptions::CompositionError::CompositionError
CompositionError(const std::string &message)
Constructs a CompositionError with an error message.
Definition exceptions_composition.h:25
fourdst::composition::exceptions::InvalidCompositionError
Exception thrown when a composition is in an invalid or inconsistent state.
Definition exceptions_composition.h:41
fourdst::composition::exceptions::SpeciesError
Base class for exceptions related to atomic species.
Definition exceptions_composition.h:59
fourdst::composition::exceptions::SpeciesError::m_message
std::string m_message
Definition exceptions_composition.h:61
fourdst::composition::exceptions::SpeciesError::what
const char * what() const noexcept override
Definition exceptions_composition.h:66
fourdst::composition::exceptions::SpeciesError::SpeciesError
SpeciesError(const std::string &message)
Definition exceptions_composition.h:63
fourdst::composition::exceptions::UnknownSymbolError
Exception thrown when an unknown symbol is encountered.
Definition exceptions_composition.h:77
fourdst::composition::exceptions::UnregisteredSymbolError
Exception thrown when a symbol is used that has not been registered.
Definition exceptions_composition.h:51
fourdst::composition::exceptions
Definition exceptions_composition.h:6
std
STL namespace.