HTTP 400 · Bad Request
EMAIL_UNCONFIRMED_X
Email unconfirmed, the length of the code must be %v.
HTTP 400
Authentication
Parameterized
When & why it happens
Email unconfirmed, the length of the code must be %v. Treated by gogram as a regular API error; inspect ErrResponseCode.Message for the exact code.
Parameterized error
The wire code carries a parameter on its tail (literal you'll see: EMAIL_UNCONFIRMED_42). Gogram parses it out and stores it on ErrResponseCode.AdditionalInfo with the right type.
Handling in gogram
Surfaced as *gogram.ErrResponseCode. Match on the message:
if err, ok := err.(*gogram.ErrResponseCode); ok {
if strings.HasPrefix(err.Message, "EMAIL_UNCONFIRMED") {
secs := err.AdditionalInfo.(int)
time.Sleep(time.Duration(secs) * time.Second)
// retry
}
}
Related errors
2FA_CONFIRM_WAIT_XYou'll be able to reset your account in %v seconds. If not, account will be deleted in 1 week for security reasons.ACCESS_TOKEN_EXPIREDAccess token expired.ACCESS_TOKEN_INVALIDAccess token invalid.AUTH_BYTES_INVALIDThe provided authorization is invalid.AUTH_KEY_DUPLICATEDThe authorization key was used under two different IP addresses simultaneously and is now invalid.AUTH_KEY_INVALIDThe Authorization Key is invalid.AUTH_KEY_PERM_EMPTYThe method is unavailable for temporary authorization keys, not bound to permanent.AUTH_KEY_UNREGISTEREDThe key is not registered in the system.AUTH_RESTARTRestart the authorization process.AUTH_TOKEN_ALREADY_ACCEPTEDThe specified auth token was already accepted.AUTH_TOKEN_EXCEPTIONAn error occurred while importing the auth token.AUTH_TOKEN_EXPIREDThe authorization token has expired.