Skip to content

Commit 27ddce2

Browse files
authored
Merge pull request #289 from umccr/feat/error-no-config
fix: error on no config
2 parents 225f6a3 + 8dd0273 commit 27ddce2

File tree

1 file changed

+6
-1
lines changed
  • htsget-config/src/config

1 file changed

+6
-1
lines changed

htsget-config/src/config/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::config::location::{Location, LocationEither, Locations};
1111
use crate::config::parser::from_path;
1212
use crate::config::service_info::ServiceInfo;
1313
use crate::config::ticket_server::TicketServerConfig;
14-
use crate::error::Error::{ArgParseError, TracingError};
14+
use crate::error::Error::{ArgParseError, ParseError, TracingError};
1515
use crate::error::Result;
1616
use crate::storage::file::File;
1717
use crate::storage::Backend;
@@ -111,6 +111,11 @@ impl Config {
111111
pub fn parse_args_with_command(augment_args: Command) -> Result<Option<PathBuf>> {
112112
let args = Args::from_arg_matches(&Args::augment_args(augment_args).get_matches())
113113
.map_err(|err| ArgParseError(err.to_string()))?;
114+
115+
if args.config.as_ref().is_some_and(|path| !path.exists()) {
116+
return Err(ParseError("config file not found".to_string()));
117+
}
118+
114119
Ok(Self::parse_with_args(args))
115120
}
116121

0 commit comments

Comments
 (0)