Improved exception handling in function template
authorhbristow <hilton.bristow@gmail.com>
Tue, 18 Jun 2013 13:13:03 +0000 (23:13 +1000)
committerhbristow <hilton.bristow@gmail.com>
Tue, 18 Jun 2013 13:13:03 +0000 (23:13 +1000)
modules/matlab/generator/templates/template_function_base.cpp

index 7286c8f..842bb3b 100644 (file)
@@ -37,7 +37,11 @@ void mexFunction(int nlhs, mxArray* plhs[],
 
   // call the opencv function
   // [out =] namespace.fun(src1, ..., srcn, dst1, ..., dstn, opt1, ..., optn);
-  {{fun.name}}();
+  try {
+    {{fun.name}}();
+  } catch(...) {
+    mexErrMsgTxt("Uncaught exception occurred in {{fun.name}}");
+  }
   {% block fcall %}
   {% endblock %}