1 #ifndef CYCLUS_SRC_ERROR_H_ 2 #define CYCLUS_SRC_ERROR_H_ 12 class Error :
public std::exception {
21 virtual const char*
what()
const throw();
104 extern std::map<Warnings, unsigned int>
warn_count;
110 extern std::map<Warnings, std::string>
warn_prefix;
114 template <Warnings T>
134 unsigned int cnt = warn_count[T]++;
135 if (cnt < warn_limit) {
136 std::cerr << warn_prefix[T] <<
": " << msg <<
"\n";
137 }
else if (cnt == 0) {
138 }
else if (cnt == warn_limit) {
139 std::cerr <<
"Further " << warn_prefix[T] <<
"s will be suppressed.\n";
145 #endif // CYCLUS_SRC_ERROR_H_ ValueError(std::string msg)
KeyError(std::string msg)
A generic mechanism to manually manage exceptions.
For failed object state expectations.
CastError(std::string msg)
std::map< Warnings, unsigned int > warn_count
The number of warnings issues for each kind.
For values that are too big, too small, etc.
For validating files received via IO.
DepricationError(std::string msg)
For failed casts that shouldn't.
unsigned int warn_limit
This is maximum number of times to issue a warning of each kind.
void msg(std::string msg)
sets the error message
bool warn_as_error
Flag for throwing an error when a warning happens.
std::map< Warnings, std::string > warn_prefixes()
Creates the warning prefixes mapping.
void Warn(const std::string &msg)
Issue a warning with the approriate message, accoring to the current warning settings.
for failed reading/writing to files, network connections, etc..
Error()
Constructs a new Error with the default message.
std::map< Warnings, std::string > warn_prefix
The number of warnings issues for each kind.
For depricating API until a next major release.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
std::string msg_
The message associated with this exception.
virtual const char * what() const
Returns the error message associated with this Error.
StateError(std::string msg)
std::string msg() const
Returns the error message associated with this Error.
For failed retrieval/insertion of key-based data into/from data structures.
ValidationError(std::string msg)