Fix fallback error handling

Start using the correct API for window.addEventListener('error',..).
Unlike when using onerror, the handler function gets an event.
This commit is contained in:
Samuel Mannehed 2016-11-28 10:02:13 +01:00
parent 38f3d92c5e
commit 38d8cfdf83
1 changed files with 6 additions and 2 deletions

View File

@ -26,12 +26,16 @@ var UI;
"use strict";
// Fallback for all uncought errors
window.addEventListener('error', function(msg, url, line) {
window.addEventListener('error', function(e) {
try {
var file = e.filename;
var line = e.lineno;
var col = e.colno;
var msg = e.error.message;
document.getElementById('noVNC_fallback_error')
.classList.add("noVNC_open");
document.getElementById('noVNC_fallback_errormsg').innerHTML =
url + ' (' + line + ') <br><br>' + msg;
msg + '<br><br>' + 'at: ' + file + ':' + line + ':' + col;
} catch (exc) {
document.write("noVNC encountered an error.");
}