There are two improvements that we can do the codebase regarding error handling.
Define constants for the error messages which are curently hardcoded in the place where they throw.
Introduce error codes for the voice authenticator same as the EmailOTP authenticator[1]. The error codes are already introduced in the VoiceOTPConstants file and not using currently.
Description:
There are two improvements that we can do the codebase regarding error handling.
[1]https://github.com/wso2-extensions/identity-local-auth-emailotp/blob/main/components/org.wso2.carbon.identity.local.auth.emailotp/src/main/java/org/wso2/carbon/identity/local/auth/emailotp/constant/AuthenticatorConstants.java#L163