From 2130630152fef1bf797b38952606f8d54ff09de1 Mon Sep 17 00:00:00 2001 From: Derek Bowes Date: Fri, 31 Oct 2014 09:30:24 -0400 Subject: [PATCH 1/2] Updated the window.onerror sample in bugLogClient.js --- client/bugLogClient.js | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/client/bugLogClient.js b/client/bugLogClient.js index 97be6cb..b5c0feb 100644 --- a/client/bugLogClient.js +++ b/client/bugLogClient.js @@ -19,14 +19,27 @@ } // Method 2: Within a global error handler (no stacktrace) - window.onerror = function(message, file, line) { - BugLog.notifyService({ - message: message, - extraInfo: 'Error occurred in: ' + file + ':' + line, - severity:"ERROR" - }); - return true; - }; + // UPDATED. Taken from Stackoverflow user Sam. See http://stackoverflow.com/a/10556743/112680 + window.onerror = function(msg, url, line, col, error) { + // Note that col & error are new to the HTML 5 spec and may not be + // supported in every browser. It worked for me in Chrome. + var extra = !col ? '' : '\ncolumn: ' + col; + extra += !error ? '' : '\nerror: ' + error; + + // You can view the information in an alert to see things working like this: + alert("Error: " + msg + "\nurl: " + url + "\nline: " + line + extra); + + BugLog.notifyService({ + message: "JS Error: "+msg, + error: "url: " + url + "
line: " + line + extra, + severity: "ERROR" + }); + + var suppressErrorAlert = true; + // If you return true, then error alerts (like in older versions of + // Internet Explorer) will be suppressed. + return suppressErrorAlert; + }; */ From 1c76dbe719a1b0fbf5e6ed845bdf241cc91b24a8 Mon Sep 17 00:00:00 2001 From: Derek Bowes Date: Fri, 31 Oct 2014 09:41:30 -0400 Subject: [PATCH 2/2] Added comments and how to fix about the errors in Chrome when using the JS client. --- client/bugLogClient.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/bugLogClient.js b/client/bugLogClient.js index b5c0feb..ea54dce 100644 --- a/client/bugLogClient.js +++ b/client/bugLogClient.js @@ -1,5 +1,13 @@ /* BugLogHQ Javascript Notification Client ( https://github.com/oarevalo/BugLogHQ ) * + ********** + PLEASE NOTE... you will get errors like the following in Chrome... + "Resource interpreted as Script but transferred with MIME type text/html:" + OR + "Refused to execute script from 'buglog/listeners/bugLogListenerREST.cfm?message=...' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled." + To get around this, create a copy of 'buglog/listeners/bugLogListenerREST.cfm' and name it 'buglog/listeners/bugLogListenerRESTjs.cfm' + and add the following line to the top + ********** * Usage: *