Fix a compilation error

This commit is contained in:
Temirkhan Myrzamadi 2020-02-19 05:32:48 +06:00
parent 9bd826ce3f
commit a02e7f37d4
2 changed files with 17 additions and 2 deletions

View file

@ -281,7 +281,7 @@ mod tests {
let tx = tx.clone();
async move {
if tx.send(update) {
if tx.send(update).is_err() {
panic!("tx.send(update) failed");
}
}

View file

@ -26,12 +26,27 @@ where
/// Something that can be handled by an error handler.
///
/// ## Examples
/// ```
/// use teloxide::error_handlers::OnError;
///
/// # #[tokio::main]
/// # async fn main_() {
/// // Prints nothing
/// let ok: Result<i32, i32> = Ok(200);
/// ok.log_on_error().await;
///
/// // Prints "Error: 404"
/// let err: Result<i32, i32> = Err(404);
/// err.log_on_error().await;
/// # }
/// ```
///
/// Use an arbitrary error handler:
/// ```
/// use teloxide::error_handlers::{IgnoringErrorHandler, OnError};
///
/// # #[tokio::main]
/// # async fn main() {
/// # async fn main_() {
/// let err: Result<i32, i32> = Err(404);
/// err.on_error(IgnoringErrorHandler::new()).await;
/// # }