MCPcopy Index your code
hub / github.com/compiler-explorer/compiler-explorer / setSentryLayout

Function setSentryLayout

static/sentry.ts:36–57  ·  view source on GitHub ↗
(l: GoldenLayout)

Source from the content-addressed store, hash-verified

34let allowSendCode: boolean;
35
36export function setSentryLayout(l: GoldenLayout) {
37 layout = l;
38 layout.eventHub.on('settingsChange', (newSettings: SiteSettings) => {
39 allowSendCode = newSettings.allowStoreCodeDebug;
40 });
41
42 Sentry.addEventProcessor(event => {
43 if (!allowSendCode) {
44 return event;
45 }
46 try {
47 const config = layout.toConfig();
48 if (event.extra === undefined) {
49 event.extra = {};
50 }
51 event.extra['full_url'] = window.location.origin + window.httpRoot + '#' + serialiseState(config);
52 } catch (e) {
53 console.log('Error adding full_url to Sentry event', e);
54 }
55 return event;
56 });
57}
58
59function isEventLike(value: unknown): value is Event {
60 return value instanceof Event || value?.constructor?.name === 'Event' || value?.constructor?.name === 'CustomEvent';

Callers 1

startFunction · 0.85

Calls 3

serialiseStateFunction · 0.85
onMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected