Skip to content

Commit

Permalink
improve status error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
morphy2k committed Dec 19, 2023
1 parent 81ba6fb commit 4a8eda1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ impl<T: Sink> Watcher<T> {

fn is_retriable(err: &Error) -> bool {
match err {
Error::Request(e) => e.is_timeout() || e.is_connect() || e.is_status(),
Error::Request(e) if e.is_timeout() || e.is_connect() => true,
Error::Request(e) if e.is_status() => {
let status = e.status().unwrap();
status.is_server_error()
}
_ => false,
}
}

0 comments on commit 4a8eda1

Please sign in to comment.