When running invalid JS code in a RunJavaScript node, the platform should log an error

Service Studio
On our radar
Whenever someone runs invalid JS code via RunJavaScript action, the failure is silent because the platform catches the exception and doesn't log anything.
This makes debugging unnecessarily complex. When the page's JS is not working as expected and you have no clue why we need to set the browser debugger to break on caught exceptions and patiently step through all of them to find something that seems familiar.
If you have some idea that the problem is in that JS code, you're still forced to do weird things like use debugger instructions or resort to printf debugging using console.log.

Ideally, the platform would log the error in Service Center. If that's too much work, at least a console.log where we can see the offending code.
Created on 3 Jun 2016
Comments (2)
The problem being that the error occurs inside your browser, not on the server, so it's a bit difficult to log anything there.

You can attach onError event on window object and sent it to server and log it  in the server log . It is simple and quite useful approach used different other application I worked on in the past .