CoolProp
Exceptions.h
1 
2 
3 #ifndef CPEXCEPTIONS_H
4 #define CPEXCEPTIONS_H
5 
6 #include <exception>
7 #include <iostream>
8 
9 namespace CoolProp
10 {
11 
12 class CoolPropBaseError: public std::exception
13 {
14 public:
15  enum ErrCode { eNotImplemented, eSolution, eAttribute, eOutOfRange, eValue, eWrongFluid, eComposition, eInput, eNotAvailable, eHandle, eKey, eUnableToLoad,eDirectorySize};
16  CoolPropBaseError(const std::string &err, ErrCode code) throw() : m_code(code), m_err(err) {}
17  ~CoolPropBaseError() throw() {};
18  virtual const char* what() const throw() { return m_err.c_str(); }
19  ErrCode code() { return m_code; }
20 private:
21  ErrCode m_code;
22  std::string m_err;
23 };
24 
25 template <CoolPropBaseError::ErrCode errcode>
27 public:
28  CoolPropError(const std::string &err = "", ErrCode ecode = errcode) throw() : CoolPropBaseError(err, ecode) {}
29 };
30 
40 
41 // ValueError specializations
42 template <CoolPropBaseError::ErrCode errcode>
43 class ValueErrorSpec : public ValueError {
44 public:
45  ValueErrorSpec(const std::string &err = "", ErrCode ecode = errcode) throw() : ValueError(err, ecode) {}
46 };
47 
52 
53 }; /* namespace CoolProp */
54 #endif
Definition: Exceptions.h:12
Definition: Exceptions.h:26
Definition: Exceptions.h:43
This file contains flash routines in which the state is unknown, and a solver of some kind must be us...
Definition: AbstractState.h:19