MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / recurse

Function recurse

packages/react/src/error.ts:20–31  ·  view source on GitHub ↗
(error: Error & { cause?: Error }, cause: Error)

Source from the content-addressed store, hash-verified

18 const seenErrors = new WeakSet();
19
20 function recurse(error: Error & { cause?: Error }, cause: Error): void {
21 // If we've already seen the error, there is a recursive loop somewhere in the error's
22 // cause chain. Let's just bail out then to prevent a stack overflow.
23 if (seenErrors.has(error)) {
24 return;
25 }
26 if (error.cause) {
27 seenErrors.add(error);
28 return recurse(error.cause, cause);
29 }
30 error.cause = cause;
31 }
32
33 recurse(error, cause);
34}

Callers 1

setCauseFunction · 0.85

Calls 2

hasMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected