added try_find_description to distinguish no desc from invalid code

This commit is contained in:
Jake Vossen 2020-02-28 15:32:09 -07:00
parent e9bca510fe
commit 5f3ffee6b7
No known key found for this signature in database
GPG key ID: B8127052D9E3817B
5 changed files with 42 additions and 17 deletions

View file

@ -786,8 +786,12 @@ impl HandlerInner {
.emitted_diagnostic_codes
.iter()
.filter_map(|x| match &x {
DiagnosticId::Error(s) if registry.find_description(s).is_some() => {
Some(s.clone())
DiagnosticId::Error(s) => {
if let Ok(Some(_explanation)) = registry.try_find_description(s) {
Some(s.clone())
} else {
None
}
}
_ => None,
})