summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2023-01-05 11:27:18 +0100
committerAlex Auvolat <alex@adnab.me>2023-01-05 11:27:18 +0100
commit19220178311ca80374f6f5ff4069c0adcaab932d (patch)
tree0c93f733cda141a39474f79b69d4658523cf5278 /src
parentb0af49c24c0f8e006e02704d398318cf74ae1d6f (diff)
downloaddf-consul-19220178311ca80374f6f5ff4069c0adcaab932d.tar.gz
df-consul-19220178311ca80374f6f5ff4069c0adcaab932d.zip
Properly handle empty node catalog
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 75091e1..8a9ad53 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -146,7 +146,7 @@ impl Consul {
&self,
host: &str,
idx: Option<usize>,
- ) -> Result<(ConsulNodeCatalog, usize)> {
+ ) -> Result<(Option<ConsulNodeCatalog>, usize)> {
debug!("watch_node {} {:?}", host, idx);
let url = match idx {
@@ -160,7 +160,7 @@ impl Consul {
None => bail!("X-Consul-Index header not found"),
};
- let resp: ConsulNodeCatalog = http.json().await?;
+ let resp: Option<ConsulNodeCatalog> = http.json().await?;
Ok((resp, new_idx))
}