From 51d6800a3239ca9f397e78279bfae4588166fd08 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 24 Oct 2021 14:50:06 +0300 Subject: [PATCH] Make RequestError::RetryAfter::0 u32, instead of i32 (you can't really wait a negative amount of time, can you?) --- CHANGELOG.md | 4 ++++ src/errors.rs | 2 +- src/types/response_parameters.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ce0aed6..3ee3c75b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## unreleased +### Changed + +- `RequestError::RetryAfter` now has a `u32` field instead of `i32` + ### Added - `UserId::{url, is_anonymous, is_channel, is_telegram}` convenience functions ([#197][pr197]) diff --git a/src/errors.rs b/src/errors.rs index be1adc40..15fd2843 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -31,7 +31,7 @@ pub enum RequestError { /// In case of exceeding flood control, the number of seconds left to wait /// before the request can be repeated. #[error("Retry after {0} seconds")] - RetryAfter(i32), + RetryAfter(u32), /// Network error while sending a request to Telegram. #[error("A network error: {0}")] diff --git a/src/types/response_parameters.rs b/src/types/response_parameters.rs index c69ce9e0..88f3a355 100644 --- a/src/types/response_parameters.rs +++ b/src/types/response_parameters.rs @@ -16,7 +16,7 @@ pub enum ResponseParameters { /// In case of exceeding flood control, the number of seconds left to wait /// before the request can be repeated. - RetryAfter(i32), + RetryAfter(u32), } #[cfg(test)]