Add error message if catalog invalid json

This commit is contained in:
Nick O'Leary 2019-04-04 11:36:12 +01:00
parent 6175fecdd8
commit d92040b804
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 15 additions and 3 deletions

View File

@ -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

View File

@ -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() {