Skip to content

Commit cd17b8b

Browse files
authored
Merge pull request #130 from nexB/114-json-format-warning
Add .fail() callback to $.getJSON() request #114
2 parents 2dc0dee + 33f0536 commit cd17b8b

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

assets/js/renderer.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ $(document).ready(function () {
483483

484484
// Open a ScanCode results JSON file
485485
ipcRenderer.on('import-JSON', function () {
486-
dialog.showOpenDialog({
486+
dialog.showOpenDialog({
487487
title: "Open a JSON File",
488488
filters: [{
489489
name: 'JSON File',
@@ -574,6 +574,16 @@ $(document).ready(function () {
574574
alert(`Error: ${err.message ? err.message : err}`);
575575
});
576576
});
577+
}).fail(function (jqxhr, textStatus, error) {
578+
// Show error for problem with the JSON file
579+
dialog.showErrorBox(
580+
"JSON Error",
581+
"There is a problem with your JSON file. It may be malformed " +
582+
"(e.g., the addition of a trailing comma), " +
583+
"or there could be some other problem with the file. " +
584+
"\n\nPlease check your file and try again. " +
585+
"\n\nThe error thrown by the system is: \n\n" + error
586+
);
577587
});
578588
});
579589
});

0 commit comments

Comments
 (0)