CYCLUS
error.cc
Go to the documentation of this file.
1 #include "error.h"
2 
3 namespace cyclus {
4 
5 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6 Error::Error(std::string msg) : msg_(msg) {}
7 
8 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9 const char* Error::what() const throw() {
10  return msg_.c_str();
11 }
12 
13 unsigned int warn_limit = 42;
14 
15 bool warn_as_error = false;
16 
17 std::map<Warnings, unsigned int> warn_count = std::map<Warnings,
18  unsigned int>();
19 
20 std::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 }
34 std::map<Warnings, std::string> warn_prefix = warn_prefixes();
35 
36 } // namespace cyclus
std::map< Warnings, unsigned int > warn_count
The number of warnings issues for each kind.
Definition: error.cc:17
unsigned int warn_limit
This is maximum number of times to issue a warning of each kind.
Definition: error.cc:13
bool warn_as_error
Flag for throwing an error when a warning happens.
Definition: error.cc:15
std::map< Warnings, std::string > warn_prefixes()
Creates the warning prefixes mapping.
Definition: error.cc:20
Error()
Constructs a new Error with the default message.
std::map< Warnings, std::string > warn_prefix
The number of warnings issues for each kind.
Definition: error.cc:34
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
Definition: agent.cc:14
std::string msg_
The message associated with this exception.
Definition: error.h:37
virtual const char * what() const
Returns the error message associated with this Error.
Definition: error.cc:9
Warnings
Definition: error.h:83