J
Jarek Katnik
Hi,
in error handler third argument gives line number of the file in which
error has been rised. How can I get name of file in which error has
been rised?
Second argument gives url to "base" html file, but what if error is
rised in imported *.js file?
Example:
--== index.html ==================-
<html>
<head>
<script src="test.js"></script>
<script type="text/javascript">
onerror = handleErr;
function handleErr(msg,url,lineNo) {
var nl = "\r\n";
alert('Msg: ' + msg + nl
+ 'URL: ' + url + nl
+ 'Line: ' + lineNo + nl);
return true;
}
</script>
</head>
<body>
<input type="button" value="Rise error" onclick="riseError()"/>
</body>
</html>
--== test.js ==================-
function riseError() {
throw "an error";
}
Best regards,
Jarek
in error handler third argument gives line number of the file in which
error has been rised. How can I get name of file in which error has
been rised?
Second argument gives url to "base" html file, but what if error is
rised in imported *.js file?
Example:
--== index.html ==================-
<html>
<head>
<script src="test.js"></script>
<script type="text/javascript">
onerror = handleErr;
function handleErr(msg,url,lineNo) {
var nl = "\r\n";
alert('Msg: ' + msg + nl
+ 'URL: ' + url + nl
+ 'Line: ' + lineNo + nl);
return true;
}
</script>
</head>
<body>
<input type="button" value="Rise error" onclick="riseError()"/>
</body>
</html>
--== test.js ==================-
function riseError() {
throw "an error";
}
Best regards,
Jarek