Builder: Singleton_registry: return null when construction spec not available

https://fedorahosted.org/freeipa/ticket/3235
This commit is contained in:
Petr Vobornik
2013-04-26 16:17:37 +02:00
parent cf8bab45fc
commit c506087227
2 changed files with 6 additions and 6 deletions

View File

@@ -276,6 +276,7 @@ define(['dojo/_base/declare',
!(cs.ctor && typeof cs.ctor === 'function')) { !(cs.ctor && typeof cs.ctor === 'function')) {
throw { throw {
error: 'Build error: missing or invalid ctor or factory', error: 'Build error: missing or invalid ctor or factory',
code: 'no-ctor-fac',
spec: cs spec: cs
}; };
} }

View File

@@ -65,13 +65,12 @@ define(['dojo/_base/declare',
var obj = this._map[type]; var obj = this._map[type];
if (!obj) { if (!obj) {
if (!this.builder) { if (!this.builder) return null;
throw { try {
error: 'Object not initialized: missing builder', obj = this._map[type] = this.builder.build(type);
ref: this } catch (e) {
}; if (e.code === 'no-ctor-fac') obj = null;
} }
obj = this._map[type] = this.builder.build(type);
} }
return obj; return obj;