core-native
Version:
A lightweight framework based on React Native + Redux + Redux Saga, in strict TypeScript.
18 lines • 705 B
JavaScript
import React from "react";
import { captureError } from "./error-util";
export class ErrorBoundary extends React.PureComponent {
constructor(props) {
super(props);
this.state = { exception: null };
}
componentDidCatch(error, errorInfo) {
const exception = captureError(error, "@@framework/error-boundary", { extraStacktrace: errorInfo.componentStack });
this.setState({ exception });
}
render() {
return this.state.exception ? this.props.render(this.state.exception) : this.props.children || null;
}
}
ErrorBoundary.displayName = "ErrorBoundary";
ErrorBoundary.defaultProps = { render: () => null };
//# sourceMappingURL=ErrorBoundary.js.map