diff options
author | Aleš Smodiš <aless@guru.si> | 2015-12-15 17:00:34 +0100 |
---|---|---|
committer | Aleš Smodiš <aless@guru.si> | 2015-12-15 17:00:34 +0100 |
commit | e906718cefc3f5fc7a279c7cae3a76fbdc184961 (patch) | |
tree | 2524a246b4e008d2fc29480a436e2c0ce5cee667 /js/codeq | |
parent | 2f1982456f85b156e152864b4d327c46a0adc4fe (diff) |
Add error reporting on uncaught errors. Add "logService" to siteDefinition for sending client logs to the server, commented out by default.
Diffstat (limited to 'js/codeq')
-rw-r--r-- | js/codeq/core.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/js/codeq/core.js b/js/codeq/core.js index c3c657f..b53ce70 100644 --- a/js/codeq/core.js +++ b/js/codeq/core.js @@ -15,7 +15,7 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ (function () { - window.siteDefinition = {logLevel: 'debug'}; // for debug purposes + window.siteDefinition = {logLevel: 'debug'/*, 'logService': '/ws/clientlog'*/}; // for debug purposes // ================================================================================ // JSON-ization (stringification) function @@ -123,7 +123,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ logs = []; $.ajax({ contentType: 'application/json', - dataType: 'application/json', type: 'POST', url: logServiceUrl, data: copyOfLogs, @@ -148,6 +147,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ return logger; })(); + // uncaught error reporting + window.onerror = function (msg, url, lineNumber) { + if ((msg !== null) && (msg instanceof Object)) msg = msg.toString(); + codeq.log.error('Uncaught error at line ' + lineNumber + ' in ' + url + ': ' + msg); + }; + // ================================================================================ // The core CodeQ module // ================================================================================ |