MCPcopy
hub / github.com/rrweb-io/rrweb / callbackWrapper

Function callbackWrapper

packages/rrweb/src/record/error-handler.ts:18–36  ·  view source on GitHub ↗
(cb: T)

Source from the content-addressed store, hash-verified

16 * Wrap callbacks in a wrapper that allows to pass errors to a configured `errorHandler` method.
17 */
18export const callbackWrapper = <T extends Callback>(cb: T): T => {
19 if (!errorHandler) {
20 return cb;
21 }
22
23 const rrwebWrapped = ((...rest: unknown[]) => {
24 try {
25 return cb(...rest);
26 } catch (error) {
27 if (errorHandler && errorHandler(error) === true) {
28 return;
29 }
30
31 throw error;
32 }
33 }) as unknown as T;
34
35 return rrwebWrapped;
36};

Callers 15

observeFunction · 0.90
initMutationObserverFunction · 0.90
initMoveObserverFunction · 0.90
getHandlerFunction · 0.90
initScrollObserverFunction · 0.90
cbWithDedupFunction · 0.90
initInputObserverFunction · 0.90
setFunction · 0.90
initStyleSheetObserverFunction · 0.90

Calls 2

cbFunction · 0.85
errorHandlerFunction · 0.85

Tested by

no test coverage detected