A 'faulty' JS node will cause prototype to not function

Summary
A JS script with an ‘undefined’ variable causes the prototype to freeze on reload.

Steps To Reproduce
I’m not a 100% sure what other factors create this problem, but simply if I have a JS node with an ‘undefined’ variable inside (tying to return something that wasn’t defined properly). The prototype does not function, e.g. elements like a drop-down from the UI kit will not work, etc.

Expected Result
I know ideally we have everything defined properly , but at least a message to make it easier to debug such a problem would be great. Otherwise things just don’t work and one might not know why.

Actual Result
No warning, just frozen (not able to interact with the prototype).