Skip to content

Commit

Permalink
Merge pull request #1502 from hubmapconsortium/bulkUp
Browse files Browse the repository at this point in the history
capture of network failures
  • Loading branch information
yuanzhou authored Dec 4, 2024
2 parents cc2e53e + ea0d88d commit b27aa66
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions src/src/components/metadata.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,36 +124,28 @@ export const RenderMetadata = (props) => {
message: resp.results.message||resp
})
} else {
console.debug('%c◉ Attach fail ', 'color:#ffe921',resp.error.response.data,resp.error.response.data.error );
// console.debug('%c◉ Attach fail ', 'color:#ffe921',resp.error );
let err = resp.error?.response?.data?.error ?? resp.error?.response ?? resp.error ?? resp;
setAttachmentFails(attachmentFails => [...attachmentFails, {
status:"failed",
row: thisRow.metadata['file_row'],
error: resp.error.response.data.error||resp
error: err
}])
fails.push({
status:"failed",
row: thisRow.metadata['file_row'],
error: resp.error.response.data.error||resp
error: err
})
}
})
.catch((error)=>{
console.debug('%c◉ entity_api_attach_bulk_metadata Call ERrr ', 'color:#ff005d', error);
// console.debug('%c⭗', 'color:#', 'Error', error);
setAttachmentFails(attachmentFails => [...attachmentFails, {
status:"failed",
row: thisRow.metadata['file_row'],
error: error.toString()
}])
})

// var errorTable = getErrorList(resp.error.response.data)
// attachErrorTable.push(errorTable)


// console.debug('%c◉ errorTable ', 'color:#ffe921', fails);
// setTable(fails)
// // setTable(table => [...table, errorTable])
// setIssues(resp.error.response.data);
// setFailed(1);
// setFailedStep(3);
// setAttaching(false);

row++
if(row === validatedMeta[0].length){
setTimeout(() => {
Expand Down Expand Up @@ -219,7 +211,11 @@ function getColNames() {
}

var errorTable = getErrorList(cleanErr)
setIssues(resp.error.response.data);
if(resp.error && resp.error.response){
setIssues(resp.error.response.data);
}else{
setIssues(resp);
}
setFailed(1);
setFailedStep(2);
setActiveStep(4);
Expand All @@ -229,7 +225,9 @@ function getColNames() {
}
})
.catch((error) => {
console.debug('%c⭗', 'color:#ff005d', 'Error', error,error.description);
console.debug('%c⭗ Error Handle Upload File', 'color:#ff005d', error,error.description);
let errorTable = getErrorList(error)
setIssues(error);
setProcessed(true);
});
};
Expand Down Expand Up @@ -503,7 +501,7 @@ const introText = () =>{
if(row.status && row.status === "failed"){
// if(typeof row.error === 'string' && row.error.indexOf("error: ") === 0){
// we're likely a API error not a CEDAR error
return <span>{row.error}</span>
return <span>{row.error.toString()}</span>
}
// let err = handleErrorRow(row)

Expand Down

0 comments on commit b27aa66

Please sign in to comment.