Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding enum variant to handle unknown 400 #902

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stillbeingnick
Copy link

@stillbeingnick stillbeingnick commented Jul 28, 2023

Change Description

Created new ApiError enum variant to handle previously unhanded 400 error from Telegram. This was highlighted in issue #901. A new test case was added so the variant would be included in the "custom_result" test for the ApiError enum.

Doc Notes

The Doc Comment that was added to the variant tries to sum up the use case the error might occur however there is no official guidance on why this would occur so please change/add if we think of a better example of why this error might occur.

Tests ran and passed after change but please let me know if there are any other considerations 馃憤

@WaffleLapkin
Copy link
Member

Did you check if you can still get MessageCantBeDeleted?

@stillbeingnick
Copy link
Author

Did you check if you can still get MessageCantBeDeleted?

I did not, but I can.

I just assumed it was a full match on the entire string because serde should visit the entire string but weird things have happened. This error mentioned in the issue did not cause the inverse to happen accidentally logging it as the known MessageCantBeDeleted because of the string similarities but I dont know if that case would be true.

@WaffleLapkin
Copy link
Member

@stillbeingnick your assumption is correct, I just want to make sure that the other (old) error actually exists, that Telegram can return it.

@stillbeingnick
Copy link
Author

Ill put together a test over the weekend and confirm it still works and update here if that is good with you @WaffleLapkin

@stillbeingnick
Copy link
Author

@WaffleLapkin it seems like your hunch might have been correct. Based on my testing I cannot get telegram to return the previous "Message can't be deleted" error message. The only case I have not tested thus far is a message being over 48 hours old. Both group message delete errors and the errors you get trying to delete dice messages that are less than 24 hours old in private chats responds with the "Message can't be deleted for everyone" error message.

I have a commit staged that removes the other variant and leaves only the new MessageCantBeDeletedForEveryone variant. However I wanted to get your thoughts on cleaning this up since this would break code that matches on that ApiError variant.

@Hirrolot
Copy link
Collaborator

Hirrolot commented Sep 6, 2023

@WaffleLapkin, what's the status of this PR?

@WaffleLapkin
Copy link
Member

Ooops, sorry, I forgot to reply here.

@stillbeingnick IMO we should keep the same variant name and only fix the matching logic, the error message changed but the meaning stayed I think.

@WaffleLapkin WaffleLapkin added C-core crate: teloxide-core S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author labels Sep 22, 2023
@WaffleLapkin WaffleLapkin self-assigned this Sep 22, 2023
@WaffleLapkin
Copy link
Member

(@stillbeingnick this is marked as S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author , please use @teloxidebot review once this is ready for review) (learn more about teloxidebot commands)

@WaffleLapkin WaffleLapkin added the A-tba-errors Area: representation of telegram bot API errors label Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tba-errors Area: representation of telegram bot API errors C-core crate: teloxide-core S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants