7#include <yaml-cpp/yaml.h>
72 const std::string&
prefix =
"")
83 std::stringstream
msg;
89 msg <<
"KeyError: " <<
key << std::endl;
92 msg <<
"The given node is a Zombie! Make sure the node you are "
93 <<
"trying to read from is valid." << std::endl;
95 else if (
node.size() == 0) {
96 msg <<
"The given node contains no entries! Make sure the desired "
97 <<
"key is available."
102 msg <<
"Make sure the desired key is available. The content of "
103 <<
"the given node is as follows:" << std::endl
104 << YAML::Dump(
node) << std::endl;
116 template<
class VecT,
class Space>
118 const std::shared_ptr<Space>& space,
119 const std::string
prefix = {})
122 std::stringstream
emsg;
123 if (
prefix.length() > 0) {
127 <<
"is not within the non-periodic space with extent"
128 << std::endl << space->extent;
141 std::cerr <<
exc.what() << std::endl;
The base exception class to derive Utopia-specific exceptions from.
Definition exceptions.hh:15
const int exit_code
The exit code to use when exiting due to this exception.
Definition exceptions.hh:18
Exception(const char *what_arg, const int exit_code_arg=1)
Construct an Utopia-specific exception.
Definition exceptions.hh:38
Exception(const std::string &what_arg, const int exit_code_arg=1)
Construct an Utopia-specific exception.
Definition exceptions.hh:26
An exception for when the program should end due to handling of a signal.
Definition exceptions.hh:51
GotSignal(const int signum)
Construct a GotSignal exception, which has a standardized what message.
Definition exceptions.hh:58
For access to a dict-like structure with a bad key.
Definition exceptions.hh:67
KeyError(const std::string &key, const DataIO::Config &node, const std::string &prefix="")
Construct a KeyError exception, which has a standardized what message.
Definition exceptions.hh:70
std::string generate_what_arg(std::string key, DataIO::Config node, std::string prefix)
Generates the what argument for the key error.
Definition exceptions.hh:79
An exception class for invalid positions in Utopia::Space.
Definition exceptions.hh:113
OutOfSpace(const VecT &invalid_pos, const std::shared_ptr< Space > &space, const std::string prefix={})
Construct the exception with the invalid position and the space given.
Definition exceptions.hh:117
YAML::Node Config
Type of a variadic dictionary-like data structure used throughout Utopia.
Definition types.hh:71
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
int handle_exception(exc_t &exc)
A helper function to handle a Utopia-specific exception.
Definition exceptions.hh:140
Definition parallel.hh:235