fix invalid logging of js errors

Change-Id: I4bbd3c7d5c7fb5c92477190e558b91adf96954de
Reviewed-on: https://gerrit.instructure.com/39304
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cameron Matheson <cameron@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2014-08-14 10:15:47 -06:00
parent 1bd1f9e236
commit bead1f3523
1 changed files with 8 additions and 1 deletions

View File

@ -54,11 +54,18 @@ define([
for(var idx in params) {
txt = txt + 'error[' + idx + "]=" + encodeURIComponent(params[idx]) + "&";
}
txt = txt.substring(0, 2000);
// make sure we don't leave hanging broken %-encodings on the end
if (txt.length >= 1 && txt[txt.length - 1] === '%') {
txt = txt.substring(0, txt.length - 1);
} else if (txt.length >= 2 && txt[txt.length - 2] === '%') {
txt = txt.substring(0, txt.length - 2);
}
INST.errorCount += 1;
// doing this old-school in case something happend where jquery is not loaded.
var img = document.createElement('img');
img.src = INST.errorURL + txt.substring(0, 2000);
img.src = INST.errorURL + txt;
img.style.position = 'absolute';
img.style.left = '-10000px';
img.style.top= 0;