fix: onLoaded callback not run on spec error

fixes #690
This commit is contained in:
Roman Hotsiy 2018-11-06 11:47:02 +02:00
parent bba40cd34a
commit e77df0ca07
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -52,7 +52,14 @@ export class StoreBuilder extends Component<StoreBuilderProps, StoreBuilderState
if (!spec) {
return undefined;
}
return new AppStore(spec, specUrl, options);
try {
return new AppStore(spec, specUrl, options);
} catch (e) {
if (this.props.onLoaded) {
this.props.onLoaded(e);
}
throw e;
}
}
componentDidMount() {