Skip to content

Commit

Permalink
fix(packager): exit with error if config not found
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog-crabnebula committed Apr 10, 2024
1 parent 8e54d00 commit 110d1b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/error-out-if-no-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cargo-packager": patch
---

Error out if we cannot find a configuration file.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions crates/packager/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ fn run_cli(cli: Cli) -> Result<()> {
};

if configs.is_empty() {
tracing::debug!("Couldn't detect a valid configuration file or all configurations are disabled! Nothing to do here.");
return Ok(());
return Err(crate::Error::NoConfig);
}

let cli_out_dir = cli.out_dir.as_ref().map(dunce::canonicalize).transpose()?;
Expand Down
3 changes: 3 additions & 0 deletions crates/packager/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ pub enum Error {
/// Target triple environment error
#[error("Unable to determine target-environment")]
Environment,
/// No config file found.
#[error("Couldn't detect a valid configuration file or all configurations are disabled.")]
NoConfig,
/// I/O errors.
#[error(transparent)]
Io(#[from] std::io::Error),
Expand Down

0 comments on commit 110d1b3

Please sign in to comment.