mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-11 10:07:42 +00:00
fix(web): only report console errors if _enabled
This commit is contained in:
parent
e3e8039d8e
commit
2e38d403b3
1 changed files with 8 additions and 2 deletions
|
|
@ -184,10 +184,14 @@ namespace com.keyman {
|
|||
initConsole() {
|
||||
// creating function declarations for better stacktraces (otherwise they'd be anonymous function expressions)
|
||||
let oldConsoleError = console.error;
|
||||
let _this = this;
|
||||
// Note that Sentry may have overridden console.error so we are re-overriding it here post-init.
|
||||
console.error = reportingConsoleError; // defined via function hoisting
|
||||
function reportingConsoleError() {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
Sentry.captureException(reduceConsoleArgs(args), { level: 'error' });
|
||||
if(_this._enabled) {
|
||||
Sentry.captureException(reduceConsoleArgs(args), { level: 'error' });
|
||||
}
|
||||
return oldConsoleError.apply(console, args);
|
||||
};
|
||||
|
||||
|
|
@ -195,7 +199,9 @@ namespace com.keyman {
|
|||
console.warn = reportingConsoleWarn; // defined via function hoisting
|
||||
function reportingConsoleWarn() {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
Sentry.captureMessage(reduceConsoleArgs(args), { level: 'warning' });
|
||||
if(_this._enabled) {
|
||||
Sentry.captureMessage(reduceConsoleArgs(args), { level: 'warning' });
|
||||
}
|
||||
return oldConsoleWarn.apply(console, args);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue