Skip to content

Commit affa527

Browse files
authored
ref(wasm): Refactor Wasm integration to use processEvent (#9019)
This refactors Wasm integration to use `processEvent`.
1 parent e448247 commit affa527

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

packages/wasm/src/index.ts

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Event, EventProcessor, Hub, Integration, StackFrame } from '@sentry/types';
1+
import type { Event, Integration, StackFrame } from '@sentry/types';
22

33
import { patchWebAssembly } from './patchWebAssembly';
44
import { getImage, getImages } from './registry';
@@ -49,26 +49,27 @@ export class Wasm implements Integration {
4949
/**
5050
* @inheritDoc
5151
*/
52-
public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, _getCurrentHub: () => Hub): void {
52+
public setupOnce(_addGlobaleventProcessor: unknown, _getCurrentHub: unknown): void {
5353
patchWebAssembly();
54+
}
5455

55-
addGlobalEventProcessor((event: Event) => {
56-
let haveWasm = false;
56+
/** @inheritDoc */
57+
public processEvent(event: Event): Event {
58+
let haveWasm = false;
5759

58-
if (event.exception && event.exception.values) {
59-
event.exception.values.forEach(exception => {
60-
if (exception?.stacktrace?.frames) {
61-
haveWasm = haveWasm || patchFrames(exception.stacktrace.frames);
62-
}
63-
});
64-
}
60+
if (event.exception && event.exception.values) {
61+
event.exception.values.forEach(exception => {
62+
if (exception?.stacktrace?.frames) {
63+
haveWasm = haveWasm || patchFrames(exception.stacktrace.frames);
64+
}
65+
});
66+
}
6567

66-
if (haveWasm) {
67-
event.debug_meta = event.debug_meta || {};
68-
event.debug_meta.images = [...(event.debug_meta.images || []), ...getImages()];
69-
}
68+
if (haveWasm) {
69+
event.debug_meta = event.debug_meta || {};
70+
event.debug_meta.images = [...(event.debug_meta.images || []), ...getImages()];
71+
}
7072

71-
return event;
72-
});
73+
return event;
7374
}
7475
}

0 commit comments

Comments
 (0)