/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */
import React from 'react';
import { useCallback } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
export function LexicalErrorBoundary({ children, onError }) {
    const wrappedOnError = useCallback((err, info) => {
        onError(err instanceof Error ? err : new Error(String(err), { cause: err }), info);
    }, [onError]);
    return (React.createElement(ErrorBoundary, { fallback: React.createElement("div", { style: {
                border: '1px solid #f00',
                color: '#f00',
                padding: '8px',
            } }, "An error was thrown."), onError: wrappedOnError }, children));
}
//# sourceMappingURL=LexicalErrorBoundary.js.map