ErrNotStartedByUser =NewAPIError(403,"Forbidden: bot can't initiate conversation with a user")
ErrBlockedByUser=NewAPIError(401,"Forbidden: bot was blocked by the user")
ErrUserIsDeactivated =NewAPIError(401,"Forbidden: user is deactivated")
ErrNotFound =NewAPIError(404,"Not Found")
ErrInternal=NewAPIError(500,"Internal Server Error")
ErrUnauthorized=NewError(401,"Unauthorized")
ErrNotStartedByUser =NewError(403,"Forbidden: bot can't initiate conversation with a user")
ErrBlockedByUser =NewError(401,"Forbidden: bot was blocked by the user")
ErrUserIsDeactivated=NewError(401,"Forbidden: user is deactivated")
ErrNotFound =NewError(404,"Not Found")
ErrInternal =NewError(500,"Internal Server Error")
)
// Bad request errors
ErrTooLarge=NewAPIError(400,"Request Entity Too Large")
ErrMessageTooLong=NewAPIError(400,"Bad Request: message is too long")
ErrToForwardNotFound=NewAPIError(400,"Bad Request: message to forward not found")
ErrToReplyNotFound=NewAPIError(400,"Bad Request: reply message not found")
ErrToDeleteNotFound=NewAPIError(400,"Bad Request: message to delete not found")
ErrEmptyMessage=NewAPIError(400,"Bad Request: message must be non-empty")
ErrEmptyText=NewAPIError(400,"Bad Request: text is empty")
ErrEmptyChatID=NewAPIError(400,"Bad Request: chat_id is empty")
ErrChatNotFound=NewAPIError(400,"Bad Request: chat not found")
ErrMessageNotModified=NewAPIError(400,"Bad Request: message is not modified")
ErrSameMessageContent=NewAPIError(400,"Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message")
ErrCantEditMessage=NewAPIError(400,"Bad Request: message can't be edited")
ErrWrongFileIDSymbol=NewAPIError(400,"Bad Request: wrong remote file id specified: can't unserialize it. Wrong last symbol")
ErrWrongFileIDLength=NewAPIError(400,"Bad Request: wrong remote file id specified: Wrong string length")
ErrWrongFileIDCharacter=NewAPIError(400,"Bad Request: wrong remote file id specified: Wrong character in the string")
ErrWrongFileIDPadding=NewAPIError(400,"Bad Request: wrong remote file id specified: Wrong padding in the string")
ErrFailedImageProcess=NewAPIError(400,"Bad Request: IMAGE_PROCESS_FAILED","Image process failed")
ErrInvalidStickerSet=NewAPIError(400,"Bad Request: STICKERSET_INVALID","Stickerset is invalid")
ErrBadPollOptions=NewAPIError(400,"Bad Request: expected an Array of String as options")
ErrGroupMigrated=NewAPIError(400,"Bad Request: group chat was upgraded to a supergroup chat")
// Bad request errors
var(
ErrTooLarge=NewError(400,"Request Entity Too Large")
ErrMessageTooLong=NewError(400,"Bad Request: message is too long")
ErrToForwardNotFound=NewError(400,"Bad Request: message to forward not found")
ErrToReplyNotFound=NewError(400,"Bad Request: reply message not found")
ErrToDeleteNotFound=NewError(400,"Bad Request: message to delete not found")
ErrEmptyMessage=NewError(400,"Bad Request: message must be non-empty")
ErrEmptyText=NewError(400,"Bad Request: text is empty")
ErrEmptyChatID=NewError(400,"Bad Request: chat_id is empty")
ErrChatNotFound=NewError(400,"Bad Request: chat not found")
ErrMessageNotModified=NewError(400,"Bad Request: message is not modified")
ErrSameMessageContent=NewError(400,"Bad Request: message is not modified: specified new message content and reply markup are exactly the same as a current content and reply markup of the message")
ErrCantEditMessage=NewError(400,"Bad Request: message can't be edited")
data=[]byte(`{"ok":false,"error_code":429,"description":"Too Many Requests: retry after 8","parameters":{"retry_after":8}}`)
data=[]byte(`{
"ok":false,
"error_code":429,
"description":"Too Many Requests: retry after 8",
"parameters":{"retry_after":8}
}`)
assert.Equal(t,FloodError{
APIError:NewAPIError(429,"Too Many Requests: retry after 8"),
err:NewError(429,"Too Many Requests: retry after 8"),
RetryAfter:8,
},extractOk(data))
data=[]byte(`{"ok":false,"error_code":400,"description":"Bad Request: group chat was upgraded to a supergroup chat","parameters":{"migrate_to_chat_id": -1234}}`)