Skip to content

Commit

Permalink
fix(lsp): make failed to load config error descriptive (#10685)
Browse files Browse the repository at this point in the history
  • Loading branch information
satyarohith authored May 18, 2021
1 parent cda09c1 commit 19e4080
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cli/config_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@ mod tests {
assert!(config_file.json.compiler_options.is_some());
}

#[test]
fn include_config_path_on_error() {
let error = ConfigFile::read("404.json").err().unwrap();
assert!(error.to_string().contains("404.json"));
}

#[test]
fn test_json_merge() {
let mut value_a = json!({
Expand Down
4 changes: 1 addition & 3 deletions cli/lsp/language_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use deno_core::error::anyhow;
use deno_core::error::AnyError;
use deno_core::error::Context;
use deno_core::resolve_url;
use deno_core::serde::Deserialize;
use deno_core::serde::Serialize;
Expand Down Expand Up @@ -432,8 +431,7 @@ impl Inner {
))
}?;

let config_file = ConfigFile::read(config_url.path())
.context("Failed to load configuration file")?;
let config_file = ConfigFile::read(config_url.path())?;
let (value, maybe_ignored_options) = config_file.as_compiler_options()?;
tsconfig.merge(&value);
self.maybe_config_uri = Some(config_url);
Expand Down

0 comments on commit 19e4080

Please sign in to comment.