Closed mw10013 closed 10 months ago
I was 100% sure this custom error was implemented @mw10013! Guess it wasn't! It's amazing that you spotted it, and of course, feel free to go ahead with its implementation!
Following the same process as the custom errors have been implemented, you should be good. As far as I remember right now, a new const
should be created in the constants.ts
file, and simply search for the error and replace it with it.
Again, thanks for all the effort you are putting into this! It helps me a lot. Sadly, lately I do not have that much time to deeply look into and keep implementing/improving things in the library! So yeah, again, thanks!
The error message for
TOTP_NOT_FOUND
is hard-coded with no option to customize.TOTP_NOT_FOUND: 'Database TOTP not found.'
If the database record of the TOTP has been deleted, perhaps by a batch that deletes expired TOTP's, the error message may surface to the user and while technically correct, may not be so helpful to the user.
Allowing the application to customize the error message provides a simple way to surface a more user friendly error message. For example, 'Code is expired'. While not technically correct, it may be more useful to the user and the application gets to make that decision.
@dev-xo: Please share your thoughts and if you would like to proceed, I can get started on it.