Skip to content

Commit

Permalink
Check error first in nvd3_vis.js
Browse files Browse the repository at this point in the history
  • Loading branch information
x4base committed Jun 21, 2016
1 parent 503f724 commit b17e00f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions caravel/assets/visualizations/nvd3_vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ function nvd3Vis(slice) {

var render = function () {
d3.json(slice.jsonEndpoint(), function (error, payload) {
slice.container.html('');
// Check error first, otherwise payload can be null
if (error) {
slice.error(error.responseText, error);
return '';
}

var width = slice.width();
var fd = payload.form_data;
var barchartWidth = function () {
Expand All @@ -30,11 +37,6 @@ function nvd3Vis(slice) {
return width;
}
};
slice.container.html('');
if (error) {
slice.error(error.responseText, error);
return '';
}
var viz_type = fd.viz_type;
var f = d3.format('.3s');
var reduceXTicks = fd.reduce_x_ticks || false;
Expand Down

0 comments on commit b17e00f

Please sign in to comment.