larroy 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_r275089596
 
 

 ##########
 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:
   Why do we need both? isn't dmlc::Error runtime_error? single catch should 
work.

----------------------------------------------------------------
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