diff --git a/mux/src/lib.rs b/mux/src/lib.rs index 52f93546d..b0146e2d4 100644 --- a/mux/src/lib.rs +++ b/mux/src/lib.rs @@ -1099,9 +1099,20 @@ impl Mux { SpawnTabDomain::DomainId(domain_id) => self .get_domain(*domain_id) .ok_or_else(|| anyhow!("domain id {} is invalid", domain_id))?, - SpawnTabDomain::DomainName(name) => self - .get_domain_by_name(&name) - .ok_or_else(|| anyhow!("domain name {} is invalid", name))?, + SpawnTabDomain::DomainName(name) => { + self.get_domain_by_name(&name).ok_or_else(|| { + let names: Vec = self + .domains_by_name + .read() + .keys() + .map(|name| format!("\"{name}\"")) + .collect(); + anyhow!( + "domain name \"{name}\" is invalid. Possible names are {}.", + names.join(", ") + ) + })? + } }; Ok(domain) }