Skip to content

Commit

Permalink
GUI display of error-report from upload
Browse files Browse the repository at this point in the history
Closes 428.
The issue was that a typo (e.g. missing double quotes around blocks) in JSON upload displays in GUI as [object Object].
upload.js : uploadParsedCb() and uploadParsedTryCb() : replace Error( with ErrorStatus(400, .
The required change was for augmentedMessage in uploadParsedTryCb(); the other 3 Error()-s are similar so the same change was applied.
Probably required also in Dataset.upload() and handleJson(), which is used by blockFeaturesAdd - which is used from the command line not the GUI.
  • Loading branch information
Don-Isdale committed Dec 2, 2024
1 parent 0584003 commit eac5e14
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lb4app/lb3app/common/utilities/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ exports.handleJson = function(msg, uploadParsed, cb) {
// Common steps for both .json and .gz files after parsing
(models, jsonMap, options, cb) => {
if(!jsonMap.name){
cb(Error('Dataset JSON has no "name" field (required)'));
cb(ErrorStatus(400, 'Dataset JSON has no "name" field (required)'));
} else {
checkQtlThenUpload();
// This check is not required because uploadParsedCb() is called after removeExisting.
Expand All @@ -328,7 +328,7 @@ exports.handleJson = function(msg, uploadParsed, cb) {
})
.catch((err) => {
console.log(err);
cb(Error('Error checking dataset existence'));
cb(ErrorStatus(404, 'Error checking dataset existence'));
});
}

Expand All @@ -354,7 +354,7 @@ exports.handleJson = function(msg, uploadParsed, cb) {
if (! jsonData) {
let message = 'No upload data';
console.log(message);
cb(Error(message));
cb(ErrorStatus(400, message));
} else
try {
let jsonMap = JSON.parse(jsonData);
Expand All @@ -373,7 +373,7 @@ exports.handleJson = function(msg, uploadParsed, cb) {
"Failed to parse JSON" +
(message ? ':\n' + message : '') +
(context ? ' in : \n' + context : '');
cb(Error(augmentedMessage));
cb(ErrorStatus(400, augmentedMessage));
}
};

Expand Down

0 comments on commit eac5e14

Please sign in to comment.