provide more information in watcher-related errors

related to https://github.com/gitbutlerapp/gitbutler/issues/2657#issuecomment-2131307753

It turns out that the UI triggers `set_project_active()`, and then moves on and emits more
commands, some of which depend on a watcher being present.

The UI could wait, but even if it does the 'endless spinner' happens.
This commit is contained in:
Sebastian Thiel 2024-05-25 17:31:06 +02:00
parent 0ffa9e814c
commit 73c21f2e42
No known key found for this signature in database
GPG Key ID: 9CB5EE7895E8268B

View File

@ -117,7 +117,11 @@ impl Watchers {
{
handle.post(action).await.context("failed to post event")
} else {
Err(anyhow::anyhow!("watcher not found",))
Err(anyhow::anyhow!(
"matching watcher to post event not found, wanted {wanted}, got {actual:?}",
wanted = action.project_id(),
actual = watcher.as_ref().map(|w| w.project_id())
))
}
}