Skip to content

Commit

Permalink
Merge pull request #2468 from Inist-CNRS/fix/2327-legend-label
Browse files Browse the repository at this point in the history
Fix(dataset): Return not found if resource has not been deleted
  • Loading branch information
ThieryMichel authored Feb 4, 2025
2 parents 8edc121 + 0f823be commit d72a95b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/controller/api/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ export const deleteDatasetRow = async (ctx, id) => {
try {
const { acknowledged, deletedCount } =
await ctx.dataset.deleteOneById(id);

if (!acknowledged || deletedCount === 0) {
throw new Error('Dataset row not found');
ctx.status = 404;
ctx.body = { status: 'error', error: `Dataset not found: ${id}` };
return;
}

ctx.body = { status: 'deleted' };
Expand Down

0 comments on commit d72a95b

Please sign in to comment.