Javascript, Octave, R - Improve exceptions for %catches

and exception specifications for native types.

Now the raised exception contains the string value as the exception
message instead of just the C/C++ type of the exception.

R exceptions were completely swallowed beforehand
This commit is contained in:
William S Fulton 2022-09-17 16:06:44 +01:00
commit 00190c484f
8 changed files with 35 additions and 17 deletions

View file

@ -26,9 +26,13 @@ SWIGEXPORT void SWIG_init(void) {
assign(name, _obj);
%end_block %enddef
%define %raise(obj,type,desc)
return R_NilValue;
%enddef
%runtime %{
void SWIG_R_Raise(SEXP obj, const char *msg) {
Rf_error(Rf_isString(obj) ? STRING_VALUE(obj) : msg);
}
%}
#define %raise(OBJ, TYPE, DESC) SWIG_R_Raise(OBJ, "C/C++ exception of type " TYPE); return R_NilValue
%insert("sinit") "srun.swg"