CYCLUS
Loading...
Searching...
No Matches
error.cc
Go to the documentation of this file.
1#include "error.h"
2
3namespace cyclus {
4
5// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6Error::Error(std::string msg) : msg_(msg) {}
7
8// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9const char* Error::what() const throw() {
10 return msg_.c_str();
11}
12
13unsigned int warn_limit = 42;
14
15bool warn_as_error = false;
16
17std::map<Warnings, unsigned int> warn_count = std::map<Warnings,
18 unsigned int>();
19
20std::map<Warnings, std::string> warn_prefixes() {
21 std::map<Warnings, std::string> wp;
22 wp[WARNING] = "Warning";
23 wp[VALUE_WARNING] = "Value Warning";
24 wp[KEY_WARNING] = "Key Warning";
25 wp[STATE_WARNING] = "State Warning";
26 wp[IO_WARNING] = "I/O Warning";
27 wp[CAST_WARNING] = "Cast Warning";
28 wp[VALIDATION_WARNING] = "Validation Warning";
29 wp[DEPRECATION_WARNING] = "Deprecation Warning";
30 wp[PENDING_DEPRECATION_WARNING] = "Pending Deprecation Warning";
31 wp[EXPERIMENTAL_WARNING] = "Experimental Warning";
32 return wp;
33}
34std::map<Warnings, std::string> warn_prefix = warn_prefixes();
35
36} // namespace cyclus
virtual const char * what() const
Returns the error message associated with this Error.
Definition error.cc:9
Error()
Constructs a new Error with the default message.
std::string msg_
The message associated with this exception.
Definition error.h:37
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
bool warn_as_error
Flag for throwing an error when a warning happens.
Definition error.cc:15
unsigned int warn_limit
This is maximum number of times to issue a warning of each kind.
Definition error.cc:13
std::map< Warnings, std::string > warn_prefix
The number of warnings issues for each kind.
Definition error.cc:34
std::map< Warnings, std::string > warn_prefixes()
Creates the warning prefixes mapping.
Definition error.cc:20
std::map< Warnings, unsigned int > warn_count
The number of warnings issues for each kind.
Definition error.cc:17
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
Warnings
Definition error.h:83
@ KEY_WARNING
Definition error.h:86
@ VALIDATION_WARNING
Definition error.h:90
@ PENDING_DEPRECATION_WARNING
Definition error.h:92
@ STATE_WARNING
Definition error.h:87
@ IO_WARNING
Definition error.h:88
@ WARNING
Definition error.h:84
@ CAST_WARNING
Definition error.h:89
@ EXPERIMENTAL_WARNING
Definition error.h:93
@ DEPRECATION_WARNING
Definition error.h:91
@ VALUE_WARNING
Definition error.h:85