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()   try { on_enter_api(__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. More...
 
#define MX_API_END()   } catch(dmlc::Error &_except_) { on_exit_api(); return MXAPIHandleException(_except_); } on_exit_api(); return 0;
 
#define MX_API_END_HANDLE_ERROR(Finalize)   } catch(dmlc::Error &_except_) { Finalize; on_exit_api(); return MXAPIHandleException(_except_); } on_exit_api(); return 0;
 

Functions

void MXAPISetLastError (const char *msg)
 Set the last error message needed by C API. More...
 
int MXAPIHandleException (const dmlc::Error &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 ( )    try { on_enter_api(__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 ( )    } catch(dmlc::Error &_except_) { on_exit_api(); return MXAPIHandleException(_except_); } on_exit_api(); return 0;
#define MX_API_END_HANDLE_ERROR (   Finalize)    } catch(dmlc::Error &_except_) { Finalize; on_exit_api(); return MXAPIHandleException(_except_); } on_exit_api(); return 0;

Function Documentation

int MXAPIHandleException ( const dmlc::Error &  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.