ErrorBoundary

Summary: _typescript_

Reviewed By: bnelo12

Differential Revision: D16830532

fbshipit-source-id: 482d16194cfe8547b9926a0b9b08cfc9e2b46972
This commit is contained in:
Daniel Büchele
2019-08-20 03:18:32 -07:00
committed by Facebook Github Bot
parent 9159256a3c
commit 84092534ce
2 changed files with 15 additions and 14 deletions

View File

@@ -5,12 +5,13 @@
* @format
*/
import ErrorBlock from './ErrorBlock.js';
import ErrorBlock from './ErrorBlock';
import {Component} from 'react';
import Heading from './Heading.tsx';
import Button from './Button.js';
import View from './View.tsx';
import styled from '../styled/index.js';
import Heading from './Heading';
import Button from './Button';
import View from './View';
import styled from 'react-emotion';
import React from 'react';
const ErrorBoundaryContainer = styled(View)({
overflow: 'auto',
@@ -24,25 +25,25 @@ const ErrorBoundaryStack = styled(ErrorBlock)({
type ErrorBoundaryProps = {
/** Function to dynamically generate the heading of the ErrorBox. */
buildHeading?: (err: Error) => string,
buildHeading?: (err: Error) => string;
/** Heading of the ErrorBox. Used as an alternative to `buildHeading`. */
heading?: string,
heading?: string;
/** Whether the stacktrace of the error is shown in the error box */
showStack?: boolean,
showStack?: boolean;
/** Code that might throw errors that will be catched */
children?: React$Node,
children?: React.ReactNode;
};
type ErrorBoundaryState = {|
error: ?Error,
|};
type ErrorBoundaryState = {
error: Error | null | undefined;
};
/**
* Boundary catching errors and displaying an ErrorBlock instead.
*/
export default class ErrorBoundary extends Component<
ErrorBoundaryProps,
ErrorBoundaryState,
ErrorBoundaryState
> {
constructor(props: ErrorBoundaryProps, context: Object) {
super(props, context);

View File

@@ -82,7 +82,7 @@ export {default as CodeBlock} from './components/CodeBlock.js';
// error
export {default as ErrorBlock} from './components/ErrorBlock.js';
export {ErrorBlockContainer} from './components/ErrorBlock.js';
export {default as ErrorBoundary} from './components/ErrorBoundary.js';
export {default as ErrorBoundary} from './components/ErrorBoundary.tsx';
// interactive components
export type {OrderableOrder} from './components/Orderable.tsx';