anirudh2290 commented on a change in pull request #14433:  Prevent crashes for 
opencv exception and std::exception
URL: https://github.com/apache/incubator-mxnet/pull/14433#discussion_r275101229
 
 

 ##########
 File path: include/mxnet/c_api_error.h
 ##########
 @@ -31,9 +31,35 @@
  * 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_BEGIN() try { on_enter_api(__FUNCTION__);
-#define MX_API_END() } catch(dmlc::Error &_except_) { on_exit_api(); return 
MXAPIHandleException(_except_); } on_exit_api(); return 0;  // NOLINT(*)
-#define MX_API_END_HANDLE_ERROR(Finalize) } catch(dmlc::Error &_except_) { 
Finalize; on_exit_api(); return MXAPIHandleException(_except_); } 
on_exit_api(); return 0; // NOLINT(*)
+#define MX_API_BEGIN()                                                         
\
+  try {                                                                        
\
+    on_enter_api(__FUNCTION__);
+#define MX_API_END()                                                           
\
+  }                                                                            
\
+  catch (dmlc::Error &_except_) {                                              
\
 
 Review comment:
   Good catch! I had kept this since i was planning on different error codes 
for frontend and this would differentiate between mxnet and non mxnet code. But 
since we are returning -1 for all currently I can remove it for now.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to