Skip to content

Commit

Permalink
Merge pull request #124 from DDMAL/err-handle
Browse files Browse the repository at this point in the history
fix: error handling for extracting image and mei data
  • Loading branch information
yinanazhou authored Jul 15, 2024
2 parents b83f170 + f172380 commit b22f326
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/Editor/CressTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,26 @@ export class CressTable {
const indices = this.columnTools.getIndices(body).map(String);

// Process images
let inputImgHeader = inputHeader.find((header) => header.includes('image'));
this.imageTools.storeImages(inputImgHeader, body);
let inputImgHeader = inputHeader.find(
(header) =>
header.toLowerCase().includes('image') ||
header.toLowerCase().includes('img'),
);
if (inputImgHeader) {
this.imageTools.storeImages(inputImgHeader, body);
} else {
Notification.queueNotification('Failed to extract image data', 'error');
}

// Process mei data
let inputMeiHeader = inputHeader.find((header) => header.includes('mei'));
this.meiTools.initMeiData(inputMeiHeader, body);
let inputMeiHeader = inputHeader.find((header) =>
header.toLowerCase().includes('mei'),
);
if (inputMeiHeader) {
this.meiTools.initMeiData(inputMeiHeader, body);
} else {
Notification.queueNotification('Failed to extract MEI data', 'error');
}

// Initialize table
this.table = new Handsontable(container, {
Expand Down

0 comments on commit b22f326

Please sign in to comment.