Skip to content

Commit

Permalink
[fix] Show error message from timeseries chart API in alert box
Browse files Browse the repository at this point in the history
  • Loading branch information
pandafy authored Feb 10, 2024
1 parent 1212b4c commit 1a32832
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,14 @@ django.jQuery(function ($) {
}
createCharts(data);
},
error: function () {
alert('Something went wrong while loading the charts');
error: function (response) {
var errorMessage = gettext('Something went wrong while loading the charts');
if (response.responseJSON) {
if (response.responseJSON.constructor === Array) {
errorMessage = errorMessage + ': ' + response.responseJSON.join(' ');
}
}
alert(errorMessage);
},
complete: function () {
triggerZoomCharts('js-plotly-plot');
Expand Down

0 comments on commit 1a32832

Please sign in to comment.