Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/vite_task/src/session/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ pub fn split_path(path: &str) -> (Option<&str>, &str) {

impl ExecutionCache {
#[tracing::instrument(level = "debug", skip_all)]
pub fn load_from_path(path: &AbsolutePath) -> anyhow::Result<Self> {
pub fn load_from_path(path: &AbsolutePath, program_name: &str) -> anyhow::Result<Self> {
tracing::info!("Creating task cache directory at {:?}", path);
std::fs::create_dir_all(path)?;

Expand Down Expand Up @@ -211,7 +211,11 @@ impl ExecutionCache {
}
11 => break, // current version
12.. => {
return Err(anyhow::anyhow!("Unrecognized database version: {user_version}"));
return Err(anyhow::anyhow!(
"Unrecognized database version: {user_version}. \
The cache may have been created by a newer version of Vite Task. \
Run `{program_name} cache clean` to remove it."
));
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/vite_task/src/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,9 @@ impl<'a> Session<'a> {
///
/// Returns an error if the cache database cannot be loaded or created.
pub fn cache(&self) -> anyhow::Result<&ExecutionCache> {
self.cache.get_or_try_init(|| ExecutionCache::load_from_path(&self.cache_path))
self.cache.get_or_try_init(|| {
ExecutionCache::load_from_path(&self.cache_path, &self.program_name)
})
}

pub fn workspace_path(&self) -> Arc<AbsolutePath> {
Expand Down
Loading