mirror of
https://github.com/ClementTsang/bottom
synced 2024-11-25 05:30:22 +00:00
other: Add the config path to the error message if unable to create config (#1515)
This commit is contained in:
parent
4b14ccb56b
commit
8f995f80e4
1 changed files with 10 additions and 2 deletions
12
src/main.rs
12
src/main.rs
|
@ -27,6 +27,7 @@ use std::{
|
||||||
boxed::Box,
|
boxed::Box,
|
||||||
io::{stderr, stdout, Write},
|
io::{stderr, stdout, Write},
|
||||||
panic::{self, PanicInfo},
|
panic::{self, PanicInfo},
|
||||||
|
path::Path,
|
||||||
sync::{
|
sync::{
|
||||||
mpsc::{self, Receiver, Sender},
|
mpsc::{self, Receiver, Sender},
|
||||||
Arc, Condvar, Mutex,
|
Arc, Condvar, Mutex,
|
||||||
|
@ -331,8 +332,15 @@ fn main() -> anyhow::Result<()> {
|
||||||
// Read from config file.
|
// Read from config file.
|
||||||
let config = {
|
let config = {
|
||||||
let config_path = get_config_path(args.general.config_location.as_deref());
|
let config_path = get_config_path(args.general.config_location.as_deref());
|
||||||
get_or_create_config(config_path.as_deref())
|
get_or_create_config(config_path.as_deref()).with_context(|| {
|
||||||
.context("Unable to parse or create the config file.")?
|
format!(
|
||||||
|
"Unable to parse or create the config file at: {}",
|
||||||
|
config_path
|
||||||
|
.as_deref()
|
||||||
|
.unwrap_or_else(|| Path::new("<failed locating>"))
|
||||||
|
.display()
|
||||||
|
)
|
||||||
|
})?
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the "app" and initialize a bunch of stuff.
|
// Create the "app" and initialize a bunch of stuff.
|
||||||
|
|
Loading…
Reference in a new issue