ErrNotStartedByUser=NewAPIError(403,"Forbidden: bot can't initiate conversation with a user")
ErrUnauthorized=NewError(401,"Unauthorized")
ErrBlockedByUser=NewAPIError(401,"Forbidden: bot was blocked by the user")
ErrNotStartedByUser=NewError(403,"Forbidden: bot can't initiate conversation with a user")
ErrUserIsDeactivated=NewAPIError(401,"Forbidden: user is deactivated")
ErrBlockedByUser=NewError(401,"Forbidden: bot was blocked by the user")
ErrNotFound=NewAPIError(404,"Not Found")
ErrUserIsDeactivated=NewError(401,"Forbidden: user is deactivated")
ErrInternal=NewAPIError(500,"Internal Server Error")
ErrNotFound=NewError(404,"Not Found")
ErrInternal=NewError(500,"Internal Server Error")
)
// Bad request errors
// Bad request errors
ErrTooLarge=NewAPIError(400,"Request Entity Too Large")
var(
ErrMessageTooLong=NewAPIError(400,"Bad Request: message is too long")
ErrTooLarge=NewError(400,"Request Entity Too Large")
ErrToForwardNotFound=NewAPIError(400,"Bad Request: message to forward not found")
ErrMessageTooLong=NewError(400,"Bad Request: message is too long")
ErrToReplyNotFound=NewAPIError(400,"Bad Request: reply message not found")
ErrToForwardNotFound=NewError(400,"Bad Request: message to forward not found")
ErrToDeleteNotFound=NewAPIError(400,"Bad Request: message to delete not found")
ErrToReplyNotFound=NewError(400,"Bad Request: reply message not found")
ErrEmptyMessage=NewAPIError(400,"Bad Request: message must be non-empty")
ErrToDeleteNotFound=NewError(400,"Bad Request: message to delete not found")
ErrEmptyText=NewAPIError(400,"Bad Request: text is empty")
ErrEmptyMessage=NewError(400,"Bad Request: message must be non-empty")
ErrEmptyChatID=NewAPIError(400,"Bad Request: chat_id is empty")
ErrEmptyText=NewError(400,"Bad Request: text is empty")
ErrChatNotFound=NewAPIError(400,"Bad Request: chat not found")
ErrEmptyChatID=NewError(400,"Bad Request: chat_id is empty")
ErrMessageNotModified=NewAPIError(400,"Bad Request: message is not modified")
ErrChatNotFound=NewError(400,"Bad Request: chat not found")
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")
ErrMessageNotModified=NewError(400,"Bad Request: message is not modified")
ErrCantEditMessage=NewAPIError(400,"Bad Request: message can't be edited")
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")
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{
assert.Equal(t,FloodError{
APIError:NewAPIError(429,"Too Many Requests: retry after 8"),
err:NewError(429,"Too Many Requests: retry after 8"),
RetryAfter:8,
RetryAfter:8,
},extractOk(data))
},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}}`)