mirror of
https://github.com/tealdeer-rs/tealdeer.git
synced 2026-08-09 09:49:10 +02:00
Cache: Return error if HTTP client cannot be created (#247)
Apparently `Client::new` can panic (see #244), so let's return the error instead.
This commit is contained in:
parent
eadfe97335
commit
84277cc31e
1 changed files with 3 additions and 1 deletions
|
|
@ -153,7 +153,9 @@ impl Cache {
|
|||
builder = builder.proxy(proxy);
|
||||
}
|
||||
}
|
||||
let client = builder.build().unwrap_or_else(|_| Client::new());
|
||||
let client = builder.build().map_err(|e| {
|
||||
TealdeerError::UpdateError(format!("Could not instantiate HTTP client: {}", e))
|
||||
})?;
|
||||
let mut resp = client.get(&self.url).send()?;
|
||||
let mut buf: Vec<u8> = vec![];
|
||||
let bytes_downloaded = resp.copy_to(&mut buf)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue