-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.h
53 lines (42 loc) · 1.16 KB
/
errors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef OOCMAP_ERRORS_H
#define OOCMAP_ERRORS_H
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <exception>
struct OocError : std::exception {
const enum ErrorCode {
NoError,
AlreadyPythonizedError, // thrown when Python has already set the error state
ImmutableValueNotFound,
InvalidBool,
CouldNotReadyString,
InvalidStringKind,
OutOfMemory,
UnknownType,
UnknownHardcodedValue,
UnexpectedData,
IndexError,
MdbError,
MutableValueNotAllowed,
WriteNotAllowed
} errorCode;
explicit OocError(const ErrorCode errorCode) : errorCode(errorCode) { }
virtual void pythonize() const;
};
struct UnknownTypeError : OocError {
PyObject* const type;
explicit UnknownTypeError(PyObject* const type) :
OocError(OocError::UnknownType),
type(type)
{ }
virtual void pythonize() const;
};
struct MdbError : OocError {
const int mdbErrorCode;
explicit MdbError(const int errorCode) :
OocError(OocError::MdbError),
mdbErrorCode(errorCode)
{ }
virtual void pythonize() const;
};
#endif //OOCMAP_ERRORS_H