Skip to content

Commit

Permalink
fix: throw errors instead of alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauris committed Mar 23, 2014
1 parent 08d1894 commit 12cf47d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions c3.js
Expand Up @@ -991,8 +991,7 @@

// check "x" is defined if timeseries
if (isTimeSeries && xs.length === 0) {
window.alert('data.x or data.xs must be specified when axis.x.type == "timeseries"');
return [];
throw new Error('data.x or data.xs must be specified when axis.x.type == "timeseries"');
}

// save x for update data by load
Expand Down Expand Up @@ -1880,8 +1879,7 @@

selectChart = d3.select(__bindto);
if (selectChart.empty()) {
window.alert('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');
return;
throw new Error('No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".');
} else {
selectChart.html("");
}
Expand Down

0 comments on commit 12cf47d

Please sign in to comment.