Skip to content

πŸŽ₯ Make videos programmatically with React

better error

Jonny Burgerb3db17aa8f26
diff --git a/packages/example/src/VisualControls/index.tsx b/packages/example/src/VisualControls/index.tsx
index 06e88c87e9..d5cb6e208c 100644
--- a/packages/example/src/VisualControls/index.tsx
+++ b/packages/example/src/VisualControls/index.tsx
@@ -10,6 +10,7 @@ export const VisualControls = () => {
zMatrix(),
);
+ // Is being tested against
const matrix2 = visualControl(`my-matrix-2`, 123);
const val3 = visualControl('my-matrix-4', 1234);
const val4 = visualControl(`value πŸ‹`, 'hi there');
diff --git a/packages/studio/src/api/get-zod-schema-from-primitive.ts b/packages/studio/src/api/get-zod-schema-from-primitive.ts
index 42a0959992..b8373cae62 100644
--- a/packages/studio/src/api/get-zod-schema-from-primitive.ts
+++ b/packages/studio/src/api/get-zod-schema-from-primitive.ts
@@ -9,5 +9,12 @@ export const getZodSchemaFromPrimitive = (value: unknown, z: ZodType) => {
return z.number();
}
- throw new Error('Unknown primitive type');
+ let stringified;
+ try {
+ stringified = JSON.stringify(value);
+ } catch {}
+
+ throw new Error(
+ `visualControl(): Specify a schema for this value: ${stringified ?? '[non-serializable value]'}. See https://remotion.dev/docs/studio/visual-control`,
+ );
};