Skip to content

Commit

Permalink
Show response parse error in alert
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazoyer committed Apr 28, 2022
1 parent 06a60ee commit 30ccec5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/looking-glass.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,13 @@ $(document).ready(function () {
$('#input-param').focus().addClass('is-invalid');
$('.alert').slideDown();
} else {
var response = $.parseJSON(response);
try {
var response = $.parseJSON(response);
} catch {
$('#error-text').html("<pre>" + response + "</pre>");
$('.alert').slideDown();
return;
}

if (response.error) {
$('#error-text').text(response.error);
Expand Down

0 comments on commit 30ccec5

Please sign in to comment.