Open ccornchip opened 3 years ago
I'm having troubles when the R script fails with an exception. I'm getting a "SyntaxError: Unexpected end of JSON input" when my R code hits an exception.
The problem is that when I hit an R exception, body is an empty string here https://github.com/joshkatz/r-script/blob/9b87a435b3604eb96d57c53e086082f2196fa077/index.js#L39
body
This then causes my whole application to crash!
May I humbly suggest changing this line to
if (body) callback(null, JSON.parse(body));
I'm having troubles when the R script fails with an exception. I'm getting a "SyntaxError: Unexpected end of JSON input" when my R code hits an exception.
The problem is that when I hit an R exception,
body
is an empty string here https://github.com/joshkatz/r-script/blob/9b87a435b3604eb96d57c53e086082f2196fa077/index.js#L39This then causes my whole application to crash!
May I humbly suggest changing this line to