Skip to content

Commit

Permalink
Show error to users if for some reason the file could not be removed
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoJokhan committed Sep 13, 2023
1 parent d6e3004 commit 41dfacf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/cms/lib/modules/resource-form-widgets/lib/budget.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ module.exports = async function(self, options) {

try {
if (fs.existsSync(attachmentsPath)) {
console.log("Removing the file")
console.log("Removing the file");
fs.rmSync(attachmentsPath, { recursive: true });
}
}
catch(e) {
console.log("The file could not be deleted");
return res.status(500).send(
JSON.stringify({
msg: "Het bestand kon niet verwijderd worden, probeer het nog eens.",
})
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ function deleteBudgetDocument(name, date, id, siteUrl) {
data: { name: name, date:date, id: id},
success: function(data) {
location.reload();
},
error: function(e) {
alert(e.responseJSON.msg);
}
});
}
Expand Down

1 comment on commit 41dfacf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Published new image: openstad/frontend:feature-budget-template-doc-on-plan-page-41dfacf

Please sign in to comment.