Skip to content

Commit

Permalink
fix: add error handling if entity is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
marianfoo committed Nov 19, 2024
1 parent 91561af commit 516009b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions importer-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module.exports = class ImporterService extends cds.ApplicationService {
this.on('UPDATE', 'Spreadsheet', async req => {
try {
const entity = cds.entities()[req.params[0].entity];
if (!entity) {
req.error(400, `Entity '${req.params[0].entity}' not found`);
return;
}
let spreadsheetSheetsData = [];
let columnNames = [];
const spreadSheet = XLSX.read(req.data.content.readableBuffer[0], {
Expand Down

0 comments on commit 516009b

Please sign in to comment.