mirror of
https://github.com/nushell/nushell.git
synced 2025-05-19 01:10:48 +02:00
parsing and error msg
This commit is contained in:
parent
31c85f71ff
commit
c6bbf140ed
@ -41,9 +41,10 @@ impl DirectorySpecificEnvironment {
|
|||||||
let content = std::str::from_utf8(&content.as_slice()).or_else(|_| {
|
let content = std::str::from_utf8(&content.as_slice()).or_else(|_| {
|
||||||
Err(ShellError::untagged_runtime_error(format!("Could not read {:?} as utf8 string", content)))
|
Err(ShellError::untagged_runtime_error(format!("Could not read {:?} as utf8 string", content)))
|
||||||
})?;
|
})?;
|
||||||
|
let content = std::fs::read_to_string(&wdirenv)?;
|
||||||
return Ok(content.parse::<toml::Value>().or_else(|_| {
|
return Ok(content.parse::<toml::Value>().or_else(|_| {
|
||||||
Err(ShellError::untagged_runtime_error(format!(
|
Err(ShellError::untagged_runtime_error(format!(
|
||||||
"Could not parse {:?}. Is it well-formed?",
|
"Could not parse {:?}. Is it well-formed? Each entry must be written as key = \"value\" (note the quotation marks)",
|
||||||
wdirenv
|
wdirenv
|
||||||
)))
|
)))
|
||||||
})?);
|
})?);
|
||||||
|
Loading…
Reference in New Issue
Block a user