Skip to content

🎥 Make videos programmatically with React

use dimension validator

Jonny Burger95b2a8de9143
diff --git a/packages/cli/src/config/height.ts b/packages/cli/src/config/height.ts
index 35fd754456..2a013650d3 100644
--- a/packages/cli/src/config/height.ts
+++ b/packages/cli/src/config/height.ts
@@ -1,12 +1,10 @@
+// eslint-disable-next-line no-restricted-imports
+import {Internals} from 'remotion';
+
let specifiedHeight: number | null;
export const setHeight = (newHeight: number) => {
- if (typeof newHeight !== 'number') {
- throw new Error(
- '--height flag / setHeight() must be a number, but got ' +
- JSON.stringify(newHeight)
- );
- }
+ Internals.validateDimension(newHeight, 'height', 'passed to `setHeight()`');
specifiedHeight = newHeight;
};
diff --git a/packages/cli/src/config/width.ts b/packages/cli/src/config/width.ts
index 98b3db1305..150eb2dc6c 100644
--- a/packages/cli/src/config/width.ts
+++ b/packages/cli/src/config/width.ts
@@ -1,11 +1,11 @@
+// eslint-disable-next-line no-restricted-imports
+import {Internals} from 'remotion';
+
let passedWidth: number | null = null;
export const setWidth = (newWidth: number) => {
if (typeof newWidth !== 'number') {
- throw new Error(
- '--width flag / setWidth() must be a number, but got ' +
- JSON.stringify(newWidth)
- );
+ Internals.validateDimension(newWidth, 'width', 'passed to `setWidth()`');
}
passedWidth = newWidth;