diff --git a/src/components/reps/value-renderer.jsx b/src/components/reps/value-renderer.jsx index e4e7a927dd..4532b8654a 100644 --- a/src/components/reps/value-renderer.jsx +++ b/src/components/reps/value-renderer.jsx @@ -11,8 +11,35 @@ export default class ValueRenderer extends React.Component { valueToRender: PropTypes.any }; + constructor(props) { + super(props); + this.state = {}; + } + + componentDidCatch(error, errorInfo) { + this.setState({ error, errorInfo }); + } + render() { const value = this.props.valueToRender; + + if (this.state.errorInfo) { + return ( +
+
{value.toString()}
+

A value renderer encountered an error.

+
+            {this.state.error && this.state.error.toString()}
+            
+ {this.state.errorInfo.componentStack} +
+ + Please file a bug report. + +
+ ); + } + const htmlString = UserReps.getUserRepIfAvailable(value); if (htmlString) { return ;