How to handle phoneNumber.sendOtp errors ? Only 500 is returned

Hey, I wanted to know if it's possible to handle errors that happen in the sendOtp option of the phoneNumber plugin. Currently, throwed errors are sent as 500 without proper error message. If the user provides a malformed input, I may want to be able to return a specific error for that, not just 500. Does someone had this problem before, or can someone help me? Wishing you a good day 😉
2 Replies
KiNFiSH
KiNFiSH•5mo ago
Can't you do it on the client side like if you want to check for malformed and if you received 500 make sure to run the client side logic. Since we get the custom phoneValidator or run the general fallback for that and return if that's fails with 500
Mattèo
MattèoOP•5mo ago
hey thanks for your reply, that might fit for a temporary solution.. Noticed this also happens in the MagicLink plugin, error thrown in the sendMagicLink method are not returning 500 error..

Did you find this page helpful?