Changeset: 41ee5e6bdf87 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41ee5e6bdf87
Modified Files:
        monetdb5/extras/rapi/rapi.c
Branch: default
Log Message:

R API: Fix for error messages


diffs (25 lines):

diff --git a/monetdb5/extras/rapi/rapi.c b/monetdb5/extras/rapi/rapi.c
--- a/monetdb5/extras/rapi/rapi.c
+++ b/monetdb5/extras/rapi/rapi.c
@@ -580,8 +580,20 @@ str RAPIeval(Client cntxt, MalBlkPtr mb,
 
        retval = R_tryEval(VECTOR_ELT(x, 0), env, &evalErr);
        if (evalErr != FALSE) {
+               char* errormsg = strdup(R_curErrorBuf());
+               if (errormsg == NULL) {
+                       msg = createException(MAL, "rapi.eval", "Error running 
R expression.");
+                       goto wrapup;
+               }
+               // remove newlines from error message so it fits into a MAPI 
error (lol)
+               size_t c;
+               for (c = 0; c < strlen(errormsg); c++) {
+                       if (errormsg[c] == '\r' || errormsg[c] == '\n') {
+                               errormsg[c] = ' ';
+                       }
+               }
                msg = createException(MAL, "rapi.eval",
-                                                         "Error running R 
expression. Error message: %s", R_curErrorBuf());
+                                                         "Error running R 
expression: %s", errormsg);
                goto wrapup;
        }
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to