Skip to main content

redicat_lib/core/
errors.rs

1use anyhow::Error;
2use std::io;
3
4/// Returns `true` if the error originated from a broken pipe.
5#[inline]
6pub fn is_broken_pipe(err: &Error) -> bool {
7    err.root_cause()
8        .downcast_ref::<io::Error>()
9        .map(|io_err| io_err.kind() == io::ErrorKind::BrokenPipe)
10        .unwrap_or(false)
11}