Skip to content

Commit e0488a1

Browse files
committed
fix(validator): include received type and value in schema validation errors
1 parent 75951b8 commit e0488a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export function defineQuery(
7777
}
7878
const desc = schemaDef[key];
7979
if (!desc.validate(value)) {
80-
throw new Error(`Schema validation failed for '${key}'`);
80+
throw new Error(
81+
`Schema validation failed for '${key}': received ${typeof value} (${JSON.stringify(value)})`,
82+
);
8183
}
8284
values[key] = escapeValue(value);
8385
} else {

0 commit comments

Comments
 (0)