propagate exceptions from global functions from cpp to python
parent
266dff0715
commit
090994a1a3
|
@ -143,6 +143,7 @@ void GlobalFunction::emit_cython_pxd(FileWriter& file) const {
|
||||||
"\"(";
|
"\"(";
|
||||||
argumentList(i).emit_cython_pxd(file, "", vector<string>());
|
argumentList(i).emit_cython_pxd(file, "", vector<string>());
|
||||||
file.oss << ")";
|
file.oss << ")";
|
||||||
|
file.oss << " except +";
|
||||||
file.oss << "\n";
|
file.oss << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -206,6 +207,10 @@ void GlobalFunction::emit_cython_pyx(FileWriter& file) const {
|
||||||
|
|
||||||
/// Call corresponding cython function
|
/// Call corresponding cython function
|
||||||
file.oss << argumentList(i).pyx_convertEigenTypeAndStorageOrder(" ");
|
file.oss << argumentList(i).pyx_convertEigenTypeAndStorageOrder(" ");
|
||||||
|
// catch exception which indicates the parameters passed are incorrect.
|
||||||
|
file.oss << " except:\n";
|
||||||
|
file.oss << " return False, None\n\n";
|
||||||
|
|
||||||
string call = pyx_functionCall("", pxdName(), i);
|
string call = pyx_functionCall("", pxdName(), i);
|
||||||
if (!returnVals_[i].isVoid()) {
|
if (!returnVals_[i].isVoid()) {
|
||||||
file.oss << " return_value = " << call << "\n";
|
file.oss << " return_value = " << call << "\n";
|
||||||
|
@ -214,8 +219,6 @@ void GlobalFunction::emit_cython_pyx(FileWriter& file) const {
|
||||||
file.oss << " " << call << "\n";
|
file.oss << " " << call << "\n";
|
||||||
file.oss << " return True, None\n";
|
file.oss << " return True, None\n";
|
||||||
}
|
}
|
||||||
file.oss << " except:\n";
|
|
||||||
file.oss << " return False, None\n\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
Loading…
Reference in New Issue