CoolProp  6.6.0
An open-source fluid property and humid air property database
Exceptions.h
Go to the documentation of this file.
1 
2 
3 #ifndef CPEXCEPTIONS_H
4 #define CPEXCEPTIONS_H
5 
6 #include <exception>
7 #include <iostream>
8 
9 namespace CoolProp {
10 
11 class CoolPropBaseError : public std::exception
12 {
13  public:
14  enum ErrCode
15  {
29  };
30  CoolPropBaseError(const std::string& err, ErrCode code) throw() : m_code(code), m_err(err) {}
31  ~CoolPropBaseError() throw(){};
32  virtual const char* what() const throw() {
33  return m_err.c_str();
34  }
36  return m_code;
37  }
38 
39  private:
40  ErrCode m_code;
41  std::string m_err;
42 };
43 
44 template <CoolPropBaseError::ErrCode errcode>
46 {
47  public:
48  CoolPropError(const std::string& err = "", ErrCode ecode = errcode) throw() : CoolPropBaseError(err, ecode) {}
49 };
50 
60 
61 // ValueError specializations
62 template <CoolPropBaseError::ErrCode errcode>
63 class ValueErrorSpec : public ValueError
64 {
65  public:
66  ValueErrorSpec(const std::string& err = "", ErrCode ecode = errcode) throw() : ValueError(err, ecode) {}
67 };
68 
73 
74 }; /* namespace CoolProp */
75 #endif