mxnet
Namespaces | Macros | Functions
c_api_error.h File Reference

Error handling for C API. More...

Go to the source code of this file.

Namespaces

 mxnet
 namespace of mxnet
 

Macros

#define MX_API_BEGIN()
 Macros to guard beginning and end section of all functions every function starts with API_BEGIN() and finishes with API_END() or API_END_HANDLE_ERROR() The finally clause contains procedure to cleanup states when an error happens. More...
 
#define MX_API_END()
 
#define MX_API_END_HANDLE_ERROR(Finalize)
 

Functions

void MXAPISetLastError (const char *msg)
 Set the last error message needed by C API. More...
 
int MXAPIHandleException (const std::exception &e)
 handle exception throwed out More...
 
void mxnet::on_enter_api (const char *function)
 
void mxnet::on_exit_api ()
 

Detailed Description

Error handling for C API.

Copyright (c) 2018 by Contributors

Macro Definition Documentation

#define MX_API_BEGIN ( )
Value:
try { \
on_enter_api(__FUNCTION__);
void on_enter_api(const char *function)

Macros to guard beginning and end section of all functions every function starts with API_BEGIN() and finishes with API_END() or API_END_HANDLE_ERROR() The finally clause contains procedure to cleanup states when an error happens.

#define MX_API_END ( )
Value:
} \
catch (const std::exception &_except_) { \
return MXAPIHandleException(_except_); \
} \
return 0;
int MXAPIHandleException(const std::exception &e)
handle exception throwed out
Definition: c_api_error.h:64
void on_exit_api()
#define MX_API_END_HANDLE_ERROR (   Finalize)
Value:
} \
catch (const std::exception &_except_) { \
Finalize; \
return MXAPIHandleException(_except_); \
} \
return 0;
int MXAPIHandleException(const std::exception &e)
handle exception throwed out
Definition: c_api_error.h:64
void on_exit_api()

Function Documentation

int MXAPIHandleException ( const std::exception &  e)
inline

handle exception throwed out

Parameters
ethe exception
Returns
the return value of API after exception is handled
void MXAPISetLastError ( const char *  msg)

Set the last error message needed by C API.

Parameters
msgThe error message to set.