mirror of
https://github.com/elysiajs/elysia
synced 2026-08-09 12:35:48 +00:00
When response validation fails on complex nested schemas (Tuples, Unions with
Objects), the dynamic handler (aot: false) was returning 500 Internal Server
Error instead of 422 Validation Error.
Root cause: exact-mirror's Clean() function generates code that directly
accesses nested properties without null checks. When called on invalid data
(e.g., ver: null instead of ver: {s: '', m: null}), it throws a TypeError.
Fix: Wrap Clean() calls in try-catch in dynamic-handle.ts, consistent with
how compose.ts (AOT mode) already handles this.
- Invalid nested response now returns 422 with proper error details
- Error includes path (/items/1/1/file/ver) and message (Expected object)
- Valid responses still return 200 as expected
- Both aot:true and aot:false now behave consistently
Closes #1659