piral-core
Version:
The core library for creating a Piral instance.
34 lines (33 loc) • 930 B
TypeScript
import * as React from 'react';
import { Errors, PiletApi } from '../types';
export interface ErrorBoundaryProps {
/**
* The type of error to indicate when caught.
*/
errorType: keyof Errors;
/**
* The associated pilet api for the metadata.
*/
piral: PiletApi;
/**
* The content to render (i.e., where to apply the boundary to).
*/
children: React.ReactNode;
}
export interface ErrorBoundaryState {
/**
* The current error (if any) caught by the boundary.
*/
error?: Error;
}
/**
* The component for catching errors and displaying error information.
*/
export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
state: {
error: any;
};
componentDidCatch(error: Error): void;
componentDidUpdate(_: ErrorBoundaryProps, prevState: ErrorBoundaryState): void;
render(): React.JSX.Element;
}