diff --git a/CHANGELOG.md b/CHANGELOG.md index 79847be90..5889d736b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Add explanation to the help text on the new feature to build query string from msg.payload #2116 - Bump bcrypt to latest - Add Korean locales files for nodes #2100 +- Add error message if catalog is invalid json #### 0.20.3: Maintenance Release diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js index d04e460d8..cdea06b77 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/palette-editor.js @@ -382,9 +382,20 @@ RED.palette.editor = (function() { catalogueLoadStart = Date.now(); var handled = 0; catalogues.forEach(function(catalog,index) { - $.getJSON(catalog, {_: new Date().getTime()},function(v) { - handleCatalogResponse(null,catalog,index,v); - refreshNodeModuleList(); + $.ajax({ + dataType: "json", + url: catalog, + data: {_: new Date().getTime()}, + success: function(v) { + try { + var parsed = JSON.parse(v); + handleCatalogResponse(null,catalog,index,parsed); + refreshNodeModuleList(); + } catch(err) { + console.error(catalog,err.toString()) + handleCatalogResponse(err,catalog,index); + } + } }).fail(function(jqxhr, textStatus, error) { handleCatalogResponse(jqxhr,catalog,index); }).always(function() {