Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
@PascalinDe suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ineiti committed Nov 16, 2023
1 parent 825e734 commit 3aefd53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::Write;
use std::time::SystemTime;
use std::{convert::TryFrom, fs, io, path::Path, sync::Arc};

use anyhow::{bail, Context, Result};
use anyhow::{anyhow, bail, Context, Result};
use arti_client::{DataStream, TorClient, TorClientConfig};
use http::{Request, Response};
use time::OffsetDateTime;
Expand Down Expand Up @@ -126,6 +126,9 @@ impl Client {
// This will probably fail for the first minutes of the day, when the churn is not yet
// available in the new version.
fn get_cache_state(cache_path: &Path) -> Result<UpdateNeeded> {
if !cache_path.is_dir() {
return Err(anyhow!("Corrupt cache: cache-directory doesn't exist"));
}
if check_directory(cache_path).is_err() {
return Ok(UpdateNeeded::All);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async fn test_directory_not_existing() {
let root_cause = error.root_cause();
assert_eq!(
format!("{}", root_cause),
"No such file or directory (os error 2)"
"Corrupt cache: cache-directory doesn't exist"
);
}

Expand Down

0 comments on commit 3aefd53

Please sign in to comment.