Commits

Anonymous committed 2baabe3

Refactored catchErrors so if disabled, will get orginal error and not a rethrown error. Need to see original error for debugging.

  • Participants
  • Parent commits bfc125c

Comments (0)

Files changed (1)

src/jqplot.core.js

             _options = options;
         }
         var plot = new jqPlot();
-        try {
+        
+        if ($.jqplot.config.catchErrors) {
+            try {
+                plot.init(target, _data, _options);
+                plot.draw();
+                plot.themeEngine.init.call(plot);
+                return plot;
+            }
+            catch(e) {
+                var msg = $.jqplot.config.errorMessage || e.message;
+                $('#'+target).append('<div style="text-align:center;position:relative;top:50%;">'+msg+'</div>');
+                $('#'+target).css({background: $.jqplot.config.errorBackground, border: $.jqplot.config.errorBorder, font: $.jqplot.config.errorFont});
+            }
+        }
+        else {        
             plot.init(target, _data, _options);
             plot.draw();
             plot.themeEngine.init.call(plot);
             return plot;
         }
-        catch(e) {
-            if ($.jqplot.config.catchErrors) {
-                var msg = $.jqplot.config.errorMessage || e.message;
-                $('#'+target).append('<div style="text-align:center;position:relative;top:50%;">'+msg+'</div>');
-                $('#'+target).css({background: $.jqplot.config.errorBackground, border: $.jqplot.config.errorBorder, font: $.jqplot.config.errorFont});
-            }
-            else {
-                throw e.message;
-            }
-        }
+        
     };
         
     $.jqplot.debug = 1;