mm-ninja-turtles / turtle-express

My attempt of making Express.JS a typesafe router with Zod.
3 stars 0 forks source link

[bug]: responding 500 code even though it's not defined in resolver or response #43

Closed PyaePhyoKyaw61194 closed 2 years ago

PyaePhyoKyaw61194 commented 2 years ago
Screenshot 2022-08-19 at 07 39 38

I tested the example code and it did not return 400. Instead, the response is 500 and 200 at a random situation.

wai-lin commented 2 years ago

It seems to be validation error is taking over the actual 400 response. It's an internal bug after changing the internally to the lifecycle.

PyaePhyoKyaw61194 commented 2 years ago

After checking for source code , I found that context.resolverValidation.error from safeParse always returns undefined. Screenshot 2022-08-20 at 22 21 22

PyaePhyoKyaw61194 commented 2 years ago

@wai-lin

PyaePhyoKyaw61194 commented 2 years ago

Since the error is undefined.,the format() method won't work.

wai-lin commented 2 years ago

@PyaePhyoKyaw61194

this should be solved in v0.1.5. Let me know if you're still experiencing this.