r-script icon indicating copy to clipboard operation
r-script copied to clipboard

Exceptions in R code poorly handled

Open ccornchip opened this issue 5 years ago • 0 comments

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

This then causes my whole application to crash!

May I humbly suggest changing this line to

    if (body) callback(null, JSON.parse(body));

ccornchip avatar Nov 30 '20 15:11 ccornchip