X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=src%2Fdygraph.js;h=df6baf9bdea01a3693c6ca3e5f7ba3e5bd94de7d;hb=refs%2Fheads%2Ftest-warnings;hp=712145892227d0374bdeab2f8a2eaece05d11a2b;hpb=79ea4032d8200129384974c9f14ff35cd3443b3f;p=dygraphs.git diff --git a/src/dygraph.js b/src/dygraph.js index 7121458..df6baf9 100644 --- a/src/dygraph.js +++ b/src/dygraph.js @@ -403,7 +403,7 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { } if (!div) { - throw 'Constructing dygraph with a non-existent div!'; + throw new Error('Constructing dygraph with a non-existent div!'); } // Copy the important bits into the object @@ -3247,9 +3247,9 @@ Dygraph.prototype.parseDataTable_ = function(data) { this.attrs_.axes.x.ticker = Dygraph.numericTicks; this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter; } else { - console.error("only 'date', 'datetime' and 'number' types are supported " + - "for column 1 of DataTable input (Got '" + indepType + "')"); - return null; + throw new Error( + "only 'date', 'datetime' and 'number' types are supported " + + "for column 1 of DataTable input (Got '" + indepType + "')"); } // Array of the column indices which contain data (and not annotations). @@ -3271,8 +3271,9 @@ Dygraph.prototype.parseDataTable_ = function(data) { } hasAnnotations = true; } else { - console.error("Only 'number' is supported as a dependent type with Gviz." + - " 'string' is only supported if displayAnnotations is true"); + throw new Error( + "Only 'number' is supported as a dependent type with Gviz." + + " 'string' is only supported if displayAnnotations is true"); } }