Skip to content

Commit f97b5e8

Browse files
committed
feat(errors): add Error::is_shutdown
1 parent f1b89c1 commit f97b5e8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/error.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ impl Error {
201201
self.find_source::<TimedOut>().is_some()
202202
}
203203

204+
/// Returns true if the error was caused by a shutdown.
205+
pub fn is_shutdown(&self) -> bool {
206+
matches!(self.inner.kind, Kind::Shutdown)
207+
}
208+
204209
/// Consumes the error, returning its cause.
205210
pub fn into_cause(self) -> Option<Box<dyn StdError + Send + Sync>> {
206211
self.inner.cause

0 commit comments

Comments
 (0)