We use window.onerror to catch unhandled exceptions (to log them for the dev team, and display a friendly user alert). Recently we noticed that in Google Chrome, the error message got truncated if it was above a certain length, and the text ...<omitted>...
was mysteriously added to the error message.
The code below will demonstrate this (in Chrome ver 33.0.1750). I was wondering if anyone else has had this problem?
<html>
<head>
<script type=text/javascript>
window.onerror = function (errorMsg, url, lineNumber) {
alert('Error: ' + errorMsg);
}
var throwError = function () {
throw new Error(
'Something went wrong. Something went wrong. Something went wrong. Something went wrong. ' +
'Something went wrong. Something went wrong. Something went wrong. Something went wrong. ' +
'Something went wrong. Something went wrong. Something went wrong. Something went wrong. ' +
'Some text gets truncated before this point!');
}
</script>
</head>
<body>
<h1>Hello World</h1>
<input type=button onclick=throwError() value=Throw uncaught error! /><br /><br />
</body>
</html>