From 4d135ac4d881cc558e71a88099ef06fe25590f67 Mon Sep 17 00:00:00 2001 From: hbristow Date: Tue, 18 Jun 2013 23:13:03 +1000 Subject: [PATCH] Improved exception handling in function template --- .../matlab/generator/templates/template_function_base.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/matlab/generator/templates/template_function_base.cpp b/modules/matlab/generator/templates/template_function_base.cpp index 7286c8f669..842bb3bb45 100644 --- a/modules/matlab/generator/templates/template_function_base.cpp +++ b/modules/matlab/generator/templates/template_function_base.cpp @@ -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 %}