Commit 3b8d4d46f6c8772a05d4805922e85f433a9e6ddd

Authored by Spencer Oberstadt
1 parent fd6f3c06
Exists in master and in 1 other branch production

improve sending of error stack on JS notifier

Showing 1 changed file with 8 additions and 8 deletions   Show diff stats
public/javascripts/notifier.js
@@ -1026,9 +1026,10 @@ printStackTrace.implementation.prototype = { @@ -1026,9 +1026,10 @@ printStackTrace.implementation.prototype = {
1026 } ()), 1026 } ()),
1027 1027
1028 project_root: this.ROOT, 1028 project_root: this.ROOT,
1029 - exception_class: (error.type || 'Error'),  
1030 - exception_message: (error.message || 'Unknown error.'),  
1031 - backtrace_lines: this.generateBacktrace(error) 1029 + exception_class: (error.type || errorWithoutDefaults.type ||
  1030 + (errorWithoutDefaults.constructor.name != "Object" ? errorWithoutDefaults.constructor.name : 'Error')),
  1031 + exception_message: (error.message || errorWithoutDefaults.message || 'Unknown error.'),
  1032 + backtrace_lines: this.generateBacktrace(errorWithoutDefaults)
1032 } 1033 }
1033 1034
1034 outputData = Util.merge(outputData, _outputData); 1035 outputData = Util.merge(outputData, _outputData);
@@ -1165,12 +1166,11 @@ printStackTrace.implementation.prototype = { @@ -1165,12 +1166,11 @@ printStackTrace.implementation.prototype = {
1165 } 1166 }
1166 }; 1167 };
1167 1168
1168 - window.onerror = function (message, file, line) { 1169 + window.onerror = function (message, file, line, code, error) {
1169 setTimeout(function () { 1170 setTimeout(function () {
1170 - new Notifier().notify({  
1171 - message: message,  
1172 - stack: '()@' + file + ':' + line  
1173 - }); 1171 + var e = error || {stack: '()@' + file + ':' + line}
  1172 + e.message = message
  1173 + new Notifier().notify(e);
1174 }, 0); 1174 }, 0);
1175 1175
1176 return true; 1176 return true;