IdoPesok / zsa

https://zsa.vercel.app
MIT License
436 stars 13 forks source link

Custom Codes Types in "ZSAError" #123

Closed Diwanshumidha closed 2 weeks ago

Diwanshumidha commented 2 weeks ago

Hi, I'm Using ZSAError() to Handle Errors. In the action I want to send error code "INSUFFICIENT_CREDITS" to the client. I know there are others way of achieving the same but was wondering if I can modify the types of the codes in ZSAError

IdoPesok commented 2 weeks ago

Hi, INSUFFICIENT_CREDITS has been added in zsa@0.3.5. As of now there is no way to modify the types of the codes in ZSAError. However, like you mentioned, you can take complete control of the error and return your own error types with shape error.