From 2b61d815dccbbf092ae1216b5304d71591643dc6 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 16 Aug 2024 16:51:13 +0800 Subject: [PATCH] Update packages/core/src/index.ts Co-authored-by: Shigma --- packages/core/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index e878afb..5713011 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -153,7 +153,7 @@ class ValidationError extends TypeError { const errorBuilder = (options: Schemastery.Options = {}) => (e: any) => { if (e instanceof Schema.ValidationError) return e; - if (typeof e === 'object' && 'message' in e) return new Schema.ValidationError(e.message, options.path) + if (e instanceof Object && 'message' in e) return new Schema.ValidationError(e.message, options.path) return e }