Table of Contents

Method UseErrorBoundary

Namespace
Velvet
Assembly
Velvet.Docs.dll

UseErrorBoundary()

Gives a component below an error boundary that boundary's reset and a way to make it catch an error — react-error-boundary's useErrorBoundary().

public static ErrorBoundaryApi UseErrorBoundary()

Returns

ErrorBoundaryApi

The boundary's reset and the error trigger.

Remarks

The boundary is the nearest [Component(IsErrorBoundary = true)] component or V.ErrorBoundary above the caller, passing over the boundaries Velvet renders for routing as react-error-boundary's context passes over React Router's; a component in a boundary's fallback content finds that boundary. ShowBoundary makes the caller throw the error on its next render, which reaches the boundaries above the caller as any render error does: the first that shows a fallback for it catches it, and one that declines passes it up. ResetBoundary invokes the boundary's reset with no arguments and forgets an error ShowBoundary was handed. Both are reference-stable.

Exceptions

InvalidOperationException

No such error boundary is above the calling component.