Skip to content

The swiss army knife of lossless video/audio editing

improve trash #228

Mikael Finstada4108210ee4a
diff --git a/src/renderer.jsx b/src/renderer.jsx
index a667a75f..074c7a0c 100644
--- a/src/renderer.jsx
+++ b/src/renderer.jsx
@@ -497,12 +497,18 @@ class App extends React.Component {
deleteSourceClick = async () => {
// eslint-disable-next-line no-alert
if (this.state.working || !window.confirm('Are you sure you want to move the source file to trash?')) return;
- const { filePath, html5FriendlyPath } = this.state;
- this.setState({ working: true });
- await trash(filePath);
- if (html5FriendlyPath) await trash(html5FriendlyPath);
- this.resetState();
+ try {
+ this.setState({ working: true });
+
+ const { filePath, html5FriendlyPath } = this.state;
+ await trash(filePath);
+ if (html5FriendlyPath) await trash(html5FriendlyPath);
+ } catch (err) {
+ toast.fire({ type: 'error', title: `Failed to trash source file: ${err.message}` });
+ } finally {
+ this.resetState();
+ }
}
cutClick = async () => {