1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-25 21:07:39 +03:00

mux: improve domain name is invalid error message

refs: #3907
This commit is contained in:
Wez Furlong 2023-07-11 08:11:39 -07:00
parent 51294e03c1
commit 46e14461eb
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387

View File

@ -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<String> = self
.domains_by_name
.read()
.keys()
.map(|name| format!("\"{name}\""))
.collect();
anyhow!(
"domain name \"{name}\" is invalid. Possible names are {}.",
names.join(", ")
)
})?
}
};
Ok(domain)
}