mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-11 11:25:34 +00:00
feat(web): adds some event metadata for reports
This commit is contained in:
parent
849cda09bb
commit
49488ed17f
2 changed files with 40 additions and 1 deletions
|
|
@ -57,10 +57,31 @@ declare var com;
|
|||
return event;
|
||||
}
|
||||
|
||||
function attachEventMetadata(event: any) {
|
||||
event.extra = event.extra || [];
|
||||
event.extra.push({
|
||||
initialized: window['keyman']['getDebugInfo']()
|
||||
});
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-processes a Sentry event object to provide more metadata and enhance the Sentry server's
|
||||
* ability to match the error against release artifacts.
|
||||
* @param event A Sentry-generated event
|
||||
*/
|
||||
function eventPreparer(event: any) {
|
||||
event = pathFilter(event);
|
||||
event = attachEventMetadata(event);
|
||||
|
||||
return null; //event
|
||||
}
|
||||
|
||||
// Do the actual Sentry initialization.
|
||||
//@ts-ignore
|
||||
Sentry.init({
|
||||
beforeSend: pathFilter,
|
||||
beforeSend: eventPreparer,
|
||||
// FIXME: DO NOT LEAVE IN PRODUCTION!
|
||||
debug: true,
|
||||
dsn: 'https://cf96f32d107c4286ab2fd82af49c4d3b@sentry.keyman.com/11', // keyman-web DSN
|
||||
|
|
|
|||
|
|
@ -177,6 +177,24 @@ namespace com.keyman {
|
|||
dom.DOMEventHandlers.states = new dom.CommonDOMStates();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a generalized metadata object about the state of KMW for use with error reporting.
|
||||
*/
|
||||
['getDebugInfo']() {
|
||||
let metadata = {
|
||||
attachType: this.options.attachType,
|
||||
initialized: this.initialized,
|
||||
isEmbedded: this.isEmbedded,
|
||||
ui: this.ui ? this.ui.name : null
|
||||
}
|
||||
|
||||
if(this.util.device.touchable) {
|
||||
metadata.ui = 'touch';
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose font testing to allow checking that SpecialOSK or custom font has
|
||||
* been correctly loaded by browser
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue