import React from "react"; import { appendClassName } from "./view-helpers"; import type { SearchContextState } from "@elastic/search-ui"; import { BaseContainerProps } from "./types"; export type ErrorBoundaryContainerContext = Pick; export type ErrorBoundaryViewProps = BaseContainerProps & ErrorBoundaryContainerContext; function ErrorBoundary({ children, className, error, ...rest }: ErrorBoundaryViewProps & React.HTMLAttributes): React.JSX.Element { if (error) { return (
{error}
); } return children as React.JSX.Element; } export default ErrorBoundary;