Skip to content

Commit cb9f26d

Browse files
committed
fix(cli): correctly bubble up errors when importing schemas
This issue was highlighted when I imported a bad path in a schema entrypoint and the only error I got was that the options were bad in the given plugin but then 0 errors were reported from that plugin... Not helpful!
1 parent 91de44a commit cb9f26d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

core/cli/src/plugin/options.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ export const validatePluginOptions = async (
3333
if (schemaEntrypoint) {
3434
const schema = await importSchemaEntryPoint({ plugin, modulePath: schemaEntrypoint })
3535
if (!schema.valid) {
36-
invalidOptions.push([id, new z.ZodError([])])
36+
invalidOptions.push([
37+
id,
38+
new z.ZodError([
39+
{
40+
message: schema.reasons.join('\n'),
41+
code: z.ZodIssueCode.custom,
42+
path: []
43+
}
44+
])
45+
])
3746
continue
3847
}
3948
pluginSchema = schema.value

0 commit comments

Comments
 (0)