I have this error handler but it doesn't set the textarea:
window.onerror = function (msg, url, lineNo, columnNo, error) {
errorBox.value = msg;
return true;
}
function throwError() {
abc.abc = abc;
}
textarea {
height: 100px;
width: 90vw;
}
<textarea id="errorBox" /></textarea>
<button onclick="throwError()">Do something</button>
UPDATE:
So here is some new information using the example.
In the example press the Do Something button. It will show the error message in the console and the textarea on the page.
But if you open Firefox dev tools and type in throwError() in the console and run it it will write to the console but not to the text area.