MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / swallow

Function swallow

packages/core/src/runtime/diagnostics.ts:32–53  ·  view source on GitHub ↗
(label: string, error?: unknown)

Source from the content-addressed store, hash-verified

30import { getDebugSurface } from "./globals.js";
31
32export function swallow(label: string, error?: unknown): void {
33 if (typeof window === "undefined") return;
34 const w = getDebugSurface();
35
36 const handler = w.__hf?.onSwallowed;
37 if (handler) {
38 try {
39 handler({ label, error });
40 } catch (handlerError) {
41 // Don't recurse into swallow() — a consumer hook that throws
42 // shouldn't be allowed to take down the runtime, and routing the
43 // failure back through swallow() would loop. Drop on the floor;
44 // the original error already had its surface above.
45 void handlerError;
46 }
47 }
48
49 if (w.__hfDebug || w.__HYPERFRAMES_DEBUG) {
50 // eslint-disable-next-line no-console -- intentional debug surface
51 console.debug(`[hyperframes] ${label} swallowed:`, error);
52 }
53}

Callers 15

postRuntimeMessageFunction · 0.90
flashElementsFunction · 0.90
safeNumFunction · 0.90
safeVoidFunction · 0.90
forEachSiblingTimelineFunction · 0.90
syncRuntimeMediaFunction · 0.90
emitAnalyticsEventFunction · 0.90
emitPickerRuntimeEventFunction · 0.90

Calls 3

getDebugSurfaceFunction · 0.85
debugMethod · 0.80
handlerFunction · 0.70

Tested by

no test coverage detected