Skip to content

The swiss army knife of lossless video/audio editing

improve error handling

Mikael Finstad260107c4e580
diff --git a/src/renderer/src/ffmpeg.ts b/src/renderer/src/ffmpeg.ts
index 3a0177d5..6dd301f0 100644
--- a/src/renderer/src/ffmpeg.ts
+++ b/src/renderer/src/ffmpeg.ts
@@ -371,7 +371,7 @@ export async function readFileMeta(filePath: string) {
});
return { format, streams, chapters };
} catch (err) {
- if (isExecaError(err)) {
+ if (isExecaError(err) && err.code == null && err.exitCode != null) {
throw new UnsupportedFileError(err.message);
}
throw err;
diff --git a/src/renderer/src/hooks/useErrorHandling.ts b/src/renderer/src/hooks/useErrorHandling.ts
index fd1249b1..0817fa0b 100644
--- a/src/renderer/src/hooks/useErrorHandling.ts
+++ b/src/renderer/src/hooks/useErrorHandling.ts
@@ -1,7 +1,6 @@
import i18n from 'i18next';
import { useCallback, useState } from 'react';
-import { errorToast } from '../swal';
import { DirectoryAccessDeclinedError, UnsupportedFileError } from '../../errors';
import { isAbortedError } from '../util';
import { GenericError } from '../components/ErrorDialog';
@@ -25,7 +24,7 @@ export default function useErrorHandling() {
if (err instanceof DirectoryAccessDeclinedError || isAbortedError(err)) return;
if (err instanceof UnsupportedFileError) {
- errorToast(i18n.t('Unsupported file'));
+ handleError({ err: i18n.t('Unsupported file') });
return;
}