Skip to content

How to use reactErrorHandler in a shared-environment(multiple scope client) #13082

Answered by AbhiPrasad
1natsu172 asked this question in Q&A
Discussion options

You must be logged in to vote

@1natsu172 I recommend just vendoring in the code and then adding an explicit call to scope.X

/**
 * Recurse through `error.cause` chain to set cause on an error.
 */
export function setCause(error: Error & { cause?: Error }, cause: Error): void {
  const seenErrors = new WeakSet();

  function recurse(error: Error & { cause?: Error }, cause: Error): void {
    // If we've already seen the error, there is a recursive loop somewhere in the error's
    // cause chain. Let's just bail out then to prevent a stack overflow.
    if (seenErrors.has(error)) {
      return;
    }
    if (error.cause) {
      seenErrors.add(error);
      return recurse(error.cause, cause);
    }
    error.cause = c…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@1natsu172
Comment options

@AbhiPrasad
Comment options

@1natsu172
Comment options

Answer selected by 1natsu172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants