treelite
runtime
native
src
c_api
c_api_error.h
1
7
#ifndef TREELITE_C_API_C_API_ERROR_H_
8
#define TREELITE_C_API_C_API_ERROR_H_
9
10
#include <dmlc/base.h>
11
#include <dmlc/logging.h>
12
#include <treelite/c_api_common.h>
13
15
#define API_BEGIN() try {
16
18
#define API_END() \
19
} catch(std::exception &_except_) { \
20
return TreeliteAPIHandleException(_except_); \
21
} \
22
return 0
23
28
#define API_END_HANDLE_ERROR(Finalize) \
29
} catch(std::exception &_except_) { \
30
Finalize; \
31
return TreeliteAPIHandleException(_except_); \
32
} \
33
return 0
34
39
void
TreeliteAPISetLastError(
const
char
* msg);
45
inline
int
TreeliteAPIHandleException(
const
std::exception &e) {
46
TreeliteAPISetLastError(e.what());
47
return
-1;
48
}
49
#endif // TREELITE_C_API_C_API_ERROR_H_
Generated by
1.8.13