changeset 295:581897df99eb

don't die when retrieving a source whose type doesn't have a constructor; instead simply warn, like we intended to, and instantiate a generic SnowlSource instance
author Myk Melez <myk@mozilla.org>
date Mon, 29 Sep 2008 16:44:52 -0700
parents 26320193da70
children 7c8e1c6430e0
files modules/service.js
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/modules/service.js	Mon Sep 29 16:38:14 2008 -0700
+++ b/modules/service.js	Mon Sep 29 16:44:52 2008 -0700
@@ -222,10 +222,13 @@
       while (this._getSourcesStatement.step()) {
         let row = this._getSourcesStatement.row;
 
-        let constructor = eval(row.type);
-        if (!constructor) {
-          this._log.warn("constructor " + row.type + " not defined; using SnowlSource");
-          constructor = SnowlSource;
+        let constructor = SnowlSource;
+        try {
+          constructor = eval(row.type);
+        }
+        catch(ex) {
+          this._log.warn("error evaling " + row.type + ": " + ex +
+                         "; falling back to SnowlSource");
         }
 
         sources.push(new constructor(row.id,