@@ -38,18 +38,25 @@ export function FormInstance(config) {
3838 this . onChange = this . onChange . bind ( this ) ;
3939
4040 this . render = function ( ) {
41- ReactDOM . render (
42- < FormContainer
43- schema = { this . schema }
44- dataInputId = { this . dataInputId }
45- data = { this . data }
46- fileHandler = { this . fileHandler }
47- fieldName = { this . fieldName }
48- modelName = { this . modelName }
49- onChange = { this . onChange }
50- /> ,
51- document . getElementById ( this . containerId )
52- ) ;
41+ try {
42+ ReactDOM . render (
43+ < FormContainer
44+ schema = { this . schema }
45+ dataInputId = { this . dataInputId }
46+ data = { this . data }
47+ fileHandler = { this . fileHandler }
48+ fieldName = { this . fieldName }
49+ modelName = { this . modelName }
50+ onChange = { this . onChange }
51+ /> ,
52+ document . getElementById ( this . containerId )
53+ ) ;
54+ } catch ( error ) {
55+ ReactDOM . render (
56+ < ErrorReporter error = { error } /> ,
57+ document . getElementById ( this . containerId )
58+ ) ;
59+ }
5360 } ;
5461
5562 this . update = function ( config ) {
@@ -147,3 +154,15 @@ export class FormContainer extends React.Component {
147154 ) ;
148155 }
149156}
157+
158+
159+ function ErrorReporter ( props ) {
160+ /* Component for displaying errors to the user related for schema */
161+
162+ return (
163+ < div style = { { color : '#f00' } } >
164+ < p > (!) { props . error . toString ( ) } </ p >
165+ < p > Check browser console for more details about the error.</ p >
166+ </ div >
167+ ) ;
168+ }
0 commit comments