Fixing bug in creation
Change-Id: Ie4059b197fecfd605c2ad8bda334a9d1d18285de
diff --git a/src/app/datasources/helpers/model-discoverer.service.ts b/src/app/datasources/helpers/model-discoverer.service.ts
index deaed33..da6f265 100644
--- a/src/app/datasources/helpers/model-discoverer.service.ts
+++ b/src/app/datasources/helpers/model-discoverer.service.ts
@@ -62,6 +62,7 @@
const pArray = [];
_.forEach(modelsDef, (model: IXosModeldef) => {
+ this.$log.debug(`[XosModelDiscovererService] Loading: ${model.name}`);
let p = this.cacheModelEntries(model)
.then(model => {
return this.addState(model);
@@ -167,15 +168,20 @@
},
component: 'xosCrud',
};
- this.XosRuntimeStates.addState(
- this.stateNameFromModel(model),
- state
- );
- // extend model
- model.clientUrl = `${this.serviceNameFromAppName(model.app)}${clientUrl}`;
+ try {
+ this.XosRuntimeStates.addState(
+ this.stateNameFromModel(model),
+ state
+ );
- d.resolve(model);
+ // extend model
+ model.clientUrl = `${this.serviceNameFromAppName(model.app)}${clientUrl}`;
+
+ d.resolve(model);
+ } catch (e) {
+ d.reject(e);
+ }
return d.promise;
}
@@ -186,13 +192,17 @@
const parentState: string = this.getParentStateFromModel(model);
- this.XosNavigationService.add({
- label: this.ConfigHelpers.pluralize(model.name),
- state: stateName,
- parent: parentState
- });
+ try {
+ this.XosNavigationService.add({
+ label: this.ConfigHelpers.pluralize(model.name),
+ state: stateName,
+ parent: parentState
+ });
+ d.resolve(model);
+ } catch (e) {
+ d.reject(e);
+ }
- d.resolve(model);
return d.promise;
}