Skip to content

Commit 2cf614d

Browse files
fix: avoid prototype-chain hits when matching error kinds.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent ca3d388 commit 2cf614d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function validateError<TKindNames>(
4444
}
4545

4646
const kind = error?.kind;
47-
if (kind in errorsMap) {
47+
if (kind != null && Object.prototype.hasOwnProperty.call(errorsMap, kind)) {
4848
const kindName = kind as TKindNames;
4949
const schema = errorsMap[kindName as any] as any;
5050
const { kind: _, ...cleanedError } = error;

0 commit comments

Comments
 (0)