Loading...
Searching...
No Matches
exceptions_composition.h
Go to the documentation of this file.
#pragma once
#include <exception>
#include <string>
#include <utility>
namespace fourdst::composition::exceptions {
class CompositionError : public std::exception {
protected:
std::string m_message;
public:
explicit CompositionError(std::string message)
: m_message(std::move(message)) {}
[[nodiscard]] 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(std::string message)
: m_message(std::move(message)) {}
[[nodiscard]] const char* what() const noexcept override {
return m_message.c_str();
}
};
class UnknownSymbolError final : public SpeciesError {
using SpeciesError::SpeciesError;
};
}
fourdst::composition::exceptions::CompositionError::m_message
std::string m_message
The error message.
Definition exceptions_composition.h:20
fourdst::composition::exceptions::CompositionError::CompositionError
CompositionError(std::string message)
Constructs a CompositionError with an error message.
Definition exceptions_composition.h:26
fourdst::composition::exceptions::CompositionError::what
const char * what() const noexcept override
Returns the error message.
Definition exceptions_composition.h:33
fourdst::composition::exceptions::InvalidCompositionError
Exception thrown when a composition is in an invalid or inconsistent state.
Definition exceptions_composition.h:42
fourdst::composition::exceptions::InvalidCompositionError::CompositionError
CompositionError(std::string message)
Constructs a CompositionError with an error message.
Definition exceptions_composition.h:26
fourdst::composition::exceptions::SpeciesError::m_message
std::string m_message
Definition exceptions_composition.h:62
fourdst::composition::exceptions::SpeciesError::SpeciesError
SpeciesError(std::string message)
Definition exceptions_composition.h:64
fourdst::composition::exceptions::SpeciesError::what
const char * what() const noexcept override
Definition exceptions_composition.h:67
fourdst::composition::exceptions::UnknownSymbolError
Exception thrown when an unknown symbol is encountered.
Definition exceptions_composition.h:78
fourdst::composition::exceptions::UnknownSymbolError::SpeciesError
SpeciesError(std::string message)
Definition exceptions_composition.h:64
fourdst::composition::exceptions::UnregisteredSymbolError
Exception thrown when a symbol is used that has not been registered.
Definition exceptions_composition.h:52
fourdst::composition::exceptions::UnregisteredSymbolError::CompositionError
CompositionError(std::string message)
Constructs a CompositionError with an error message.
Definition exceptions_composition.h:26
fourdst::composition::exceptions
Definition exceptions_composition.h:7