CoolProp
6.6.0
An open-source fluid property and humid air property database
include
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
{
16
eNotImplemented
,
17
eSolution
,
18
eAttribute
,
19
eOutOfRange
,
20
eValue
,
21
eWrongFluid
,
22
eComposition
,
23
eInput
,
24
eNotAvailable
,
25
eHandle
,
26
eKey
,
27
eUnableToLoad
,
28
eDirectorySize
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
}
35
ErrCode
code
() {
36
return
m_code;
37
}
38
39
private
:
40
ErrCode
m_code;
41
std::string m_err;
42
};
43
44
template
<CoolPropBaseError::ErrCode errcode>
45
class
CoolPropError
:
public
CoolPropBaseError
46
{
47
public
:
48
CoolPropError
(
const
std::string& err =
""
,
ErrCode
ecode = errcode)
throw
() :
CoolPropBaseError
(err, ecode) {}
49
};
50
51
typedef
CoolPropError<CoolPropBaseError::eNotImplemented>
NotImplementedError
;
52
typedef
CoolPropError<CoolPropBaseError::eSolution>
SolutionError
;
53
typedef
CoolPropError<CoolPropBaseError::eAttribute>
AttributeError
;
54
typedef
CoolPropError<CoolPropBaseError::eOutOfRange>
OutOfRangeError
;
55
typedef
CoolPropError<CoolPropBaseError::eValue>
ValueError
;
56
typedef
CoolPropError<CoolPropBaseError::eKey>
KeyError
;
57
typedef
CoolPropError<CoolPropBaseError::eHandle>
HandleError
;
58
typedef
CoolPropError<CoolPropBaseError::eUnableToLoad>
UnableToLoadError
;
59
typedef
CoolPropError<CoolPropBaseError::eDirectorySize>
DirectorySizeError
;
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
69
typedef
ValueErrorSpec<CoolPropBaseError::eWrongFluid>
WrongFluidError
;
70
typedef
ValueErrorSpec<CoolPropBaseError::eComposition>
CompositionError
;
71
typedef
ValueErrorSpec<CoolPropBaseError::eInput>
InputError
;
72
typedef
ValueErrorSpec<CoolPropBaseError::eNotAvailable>
NotAvailableError
;
73
74
};
/* namespace CoolProp */
75
#endif
Generated on Wed Nov 29 2023 14:26:23 for CoolProp by
1.9.1