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')) {
throw {
error: 'Build error: missing or invalid ctor or factory',
code: 'no-ctor-fac',
spec: cs
};
}

View File

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