Skip to content

🎥 Make videos programmatically with React

fix(core): report non-finite durationInFrames as non-finite

DeryFerd046ced5848f9
diff --git a/packages/core/src/validation/validate-duration-in-frames.ts b/packages/core/src/validation/validate-duration-in-frames.ts
index aff0322788..8dafd1da7a 100644
--- a/packages/core/src/validation/validate-duration-in-frames.ts
+++ b/packages/core/src/validation/validate-duration-in-frames.ts
@@ -22,15 +22,15 @@ export function validateDurationInFrames(
);
}
- if (!allowFloats && durationInFrames % 1 !== 0) {
+ if (!Number.isFinite(durationInFrames)) {
throw new TypeError(
- `The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`,
+ `The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`,
);
}
- if (!Number.isFinite(durationInFrames)) {
+ if (!allowFloats && durationInFrames % 1 !== 0) {
throw new TypeError(
- `The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`,
+ `The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`,
);
}
}