Skip to content

🎥 Make videos programmatically with React

refactor this

Jonny Burgerf5feb0295942
diff --git a/packages/cli/src/index.tsx b/packages/cli/src/index.tsx
index 4bd219e3c1..17116ef0d5 100644
--- a/packages/cli/src/index.tsx
+++ b/packages/cli/src/index.tsx
@@ -1,4 +1,5 @@
import {checkNodeVersion} from './check-version';
+import {handleCommonError} from './handle-common-errors';
import {Log} from './log';
import {parsedCli} from './parse-command-line';
import {previewCommand} from './preview';
@@ -36,7 +37,7 @@ export const cli = async () => {
process.exit(1);
}
} catch (err) {
- Log.error((err as Error).stack);
+ handleCommonError(err as Error);
process.exit(1);
}
};
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 08ba09349b..cc1e27230e 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -1,6 +1,5 @@
import {
getCompositions,
- OnErrorInfo,
OnStartData,
renderFrames,
RenderInternals,
@@ -13,7 +12,6 @@ import path from 'path';
import {Internals} from 'remotion';
import {getCliOptions} from './get-cli-options';
import {getCompositionId} from './get-composition-id';
-import {handleCommonError} from './handle-common-errors';
import {initializeRenderCli} from './initialize-render-cli';
import {Log} from './log';
import {parsedCli} from './parse-command-line';
@@ -25,23 +23,6 @@ import {
import {bundleOnCli} from './setup-cache';
import {checkAndValidateFfmpegVersion} from './validate-ffmpeg-version';
-const onError = async (info: OnErrorInfo) => {
- Log.error();
- if (info.frame === null) {
- Log.error(
- 'The following error occured when trying to initialize the video rendering:'
- );
- } else {
- Log.error(
- `The following error occurred when trying to render frame ${info.frame}:`
- );
- }
-
- handleCommonError(info.error);
-
- process.exit(1);
-};
-
export const render = async () => {
const startTime = Date.now();
const file = parsedCli._[1];
@@ -128,7 +109,6 @@ export const render = async () => {
parallelism,
compositionId,
outputDir,
- onError,
onStart: ({frameCount: fc}: OnStartData) => {
renderProgress.update(
makeRenderingProgress({