CoolProp 8.0.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 <string>
8
9namespace CoolProp {
10
11class CoolPropBaseError : public std::exception
12{
13 public:
15 {
30 };
31 CoolPropBaseError(const std::string& err, ErrCode code) throw() : m_code(code), m_err(err) {}
32 ~CoolPropBaseError() throw() = default;
33 const char* what() const throw() override {
34 return m_err.c_str();
35 }
37 return m_code;
38 }
39
40 private:
41 ErrCode m_code;
42 std::string m_err;
43};
44
45template <CoolPropBaseError::ErrCode errcode>
47{
48 public:
49 CoolPropError(const std::string& err = "", ErrCode ecode = errcode) throw() : CoolPropBaseError(err, ecode) {}
50};
51
61
62// ValueError specializations
63template <CoolPropBaseError::ErrCode errcode>
65{
66 public:
67 ValueErrorSpec(const std::string& err = "", ErrCode ecode = errcode) throw() : ValueError(err, ecode) {}
68};
69
79
80}; /* namespace CoolProp */
81#endif