Log debug errors to firebug console, if available
authorMichael M Slusarz <slusarz@curecanti.org>
Sat, 14 Mar 2009 14:55:28 +0000 (08:55 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Sat, 14 Mar 2009 14:55:28 +0000 (08:55 -0600)
imp/js/src/DimpCore.js

index 4936d2f..e4f7751 100644 (file)
@@ -33,7 +33,12 @@ DimpCore = {
     debug: function(label, e)
     {
         if (!this.is_logout && DIMP.conf.debug) {
-            alert(label + ': ' + ((e instanceof Error && e.name && e.message) ? e.name + '-' + e.message : Object.inspect(e)) + (e.lineNumber ? ' (Line #' + e.lineNumber + ')' : ''));
+            if (console) {
+                // Firebug error reporting.
+                console.error(label, e);
+            } else {
+                alert(label + ': ' + ((e instanceof Error && e.name && e.message) ? e.name + '-' + e.message : Object.inspect(e)) + (e.lineNumber ? ' (Line #' + e.lineNumber + ')' : ''));
+            }
         }
     },