Browse Source

Fix err detection

jmacura 5 years ago
parent
commit
b3d94666c2
1 changed files with 4 additions and 2 deletions
  1. 4 2
      index.js

+ 4 - 2
index.js

@@ -132,8 +132,10 @@ app.get('/runR', (req, res, next) => {
         function(err, data) {
         function(err, data) {
             console.log('R done');
             console.log('R done');
             if (err) console.log(err.toString('utf8'))
             if (err) console.log(err.toString('utf8'))
-            else console.log(data);
-            if (!data) data = {result: 'R call succesful'}
+            else {
+							console.log(data);
+              data = {result: 'R call succesful'};
+						}
             helpers.formatResponse({ response: data }, req, res);
             helpers.formatResponse({ response: data }, req, res);
         }
         }
     );
     );