summaryrefslogtreecommitdiff
path: root/cli/lsp/registries.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2022-01-20 08:05:19 +1100
committerGitHub <noreply@github.com>2022-01-20 08:05:19 +1100
commit6cf05220e3370365a2c6ce8116d1c5624004ca59 (patch)
tree61f7b9d6270f697759a55db163baf1522b38c092 /cli/lsp/registries.rs
parent1cece36fa5d9e35406b22e8d6ed94bfc7fc5621a (diff)
fix(lsp): better handling of registry config errors (#13418)
Fixes: #13383 Fixes: denoland/vscode_deno#609
Diffstat (limited to 'cli/lsp/registries.rs')
-rw-r--r--cli/lsp/registries.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/cli/lsp/registries.rs b/cli/lsp/registries.rs
index 94c3c49fc..418c19fe3 100644
--- a/cli/lsp/registries.rs
+++ b/cli/lsp/registries.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
+use super::logging::lsp_log;
use super::path_to_regex::parse;
use super::path_to_regex::string_to_regex;
use super::path_to_regex::Compiler;
@@ -544,8 +545,19 @@ impl ModuleRegistry {
// we can't use entry().or_insert_with() because we can't use async closures
if !self.origins.contains_key(&origin) {
let specifier = origin_url.join(CONFIG_PATH)?;
- let configs = self.fetch_config(&specifier).await?;
- self.origins.insert(origin, configs);
+ match self.fetch_config(&specifier).await {
+ Ok(configs) => {
+ self.origins.insert(origin, configs);
+ }
+ Err(err) => {
+ lsp_log!(
+ " Error fetching registry config for \"{}\": {}",
+ origin,
+ err.to_string()
+ );
+ self.origins.remove(&origin);
+ }
+ }
}
Ok(())