Open and-rose opened 2 weeks ago
Looks like this might be identical to #487 and #210.
I've also faced this similar issue. I've overcome this issue by manually catching the case when t.Numeric
validation fails:
case 'UNKNOWN': {
// Tackling the bug related to: https://github.com/elysiajs/elysia/issues/792
if (error instanceof TypeBoxError) {
set.status = 422
console.log('picked wrong', error)
return error.message
}
logger.error('Unknown error on API', error)
set.status = 500
return 'Unknown error'
}
But this is not ideal
This issue also occurs to me when parsing query
Not that I expected to see this resolved; this still exists in 1.1.12
What version of Elysia is running?
1.1.7
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
Create a simple index.ts file with the following Elysia handlers
What is the expected behavior?
I'd expect to see the validation fail and get marked as code = "VALIDATION" to return my custom
400
status codeWhat do you see instead?
curling the endpoint gives the following
567
status code through theUNKNOWN
arm of the switch statementAdditional information
I mostly wanted to make sure my instance would spit out a 400 when any kind of validation error occurred, but this specific case with an attribute on top seems to slip through without an identifiable code. Maybe I'm doing something wrong?
Have you try removing the
node_modules
andbun.lockb
and try again yet?yes