# fourdst::libcomposition: src/composition/include/fourdst/composition/exceptions/exceptions_composition.h Source File

Loading...
Searching...
No Matches
exceptions_composition.h
Go to the documentation of this file.
#pragma once
#include <exception>
#include <string>
namespace fourdst::composition::exceptions {
class CompositionError : public std::exception {
protected:
std::string m_message;
public:
explicit CompositionError(const std::string& message)
: m_message(std::move(message)) {}
const char* what() const noexcept override{
return m_message.c_str();
}
};
class InvalidCompositionError final : public CompositionError {
using CompositionError::CompositionError;
};
class UnregisteredSymbolError final : public CompositionError {
using CompositionError::CompositionError;
};
class SpeciesError : public std::exception {
protected:
std::string m_message;
public:
explicit SpeciesError(const std::string& message)
: m_message(std::move(message)) {}
const char* what() const noexcept override {
return m_message.c_str();
}
};
class UnknownSymbolError final : public SpeciesError {
using SpeciesError::SpeciesError;
};
}
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.