summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2013-04-26 16:17:37 +0200
committerPetr Vobornik <pvoborni@redhat.com>2013-05-06 16:22:30 +0200
commitc506087227acdbc9edba8f000fe7a7ab3abdf621 (patch)
treeff8c8ddf4b202433a448e34d234c25bce49226d8
parentcf8bab45fc5b4d8390f99818fbf144d666698024 (diff)
downloadfreeipa-c506087227acdbc9edba8f000fe7a7ab3abdf621.tar.gz
freeipa-c506087227acdbc9edba8f000fe7a7ab3abdf621.tar.xz
freeipa-c506087227acdbc9edba8f000fe7a7ab3abdf621.zip
Builder: Singleton_registry: return null when construction spec not available
https://fedorahosted.org/freeipa/ticket/3235
-rw-r--r--install/ui/src/freeipa/_base/Builder.js1
-rw-r--r--install/ui/src/freeipa/_base/Singleton_registry.js11
2 files changed, 6 insertions, 6 deletions
diff --git a/install/ui/src/freeipa/_base/Builder.js b/install/ui/src/freeipa/_base/Builder.js
index d14721018..e4669ed9e 100644
--- a/install/ui/src/freeipa/_base/Builder.js
+++ b/install/ui/src/freeipa/_base/Builder.js
@@ -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
};
}
diff --git a/install/ui/src/freeipa/_base/Singleton_registry.js b/install/ui/src/freeipa/_base/Singleton_registry.js
index fe8065468..a3427d7e0 100644
--- a/install/ui/src/freeipa/_base/Singleton_registry.js
+++ b/install/ui/src/freeipa/_base/Singleton_registry.js
@@ -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;
}
- obj = this._map[type] = this.builder.build(type);
}
return obj;