Skip to content

Commit

Permalink
Fix generation error for invalid lockifests (#1303)
Browse files Browse the repository at this point in the history
This changes the error output for lockifests which cannot be parsed as
lockfiles when manifest generation is disabled with `--no-generation`.
Instead of printing the parsing error of the lockfile, we now print an
error that manifest generation is required.

Closes #1295.
  • Loading branch information
cd-work authored Nov 27, 2023
1 parent 69f3df9 commit 7d5aaba
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cli/src/commands/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,13 @@ pub fn parse_lockfile(
}

// Abort if generation is disabled or path is neither lockfile nor manifest.
if !generate_lockfiles || !parser.is_path_manifest(&path) {
let maybe_manifest = parser.is_path_manifest(&path);
if !(generate_lockfiles && maybe_manifest) {
// Return the original lockfile parsing error.
match lockfile_error {
Some(err) => return Err(err.into()),
None => return Err(ParseError::ManifestWithoutGeneration(path)),
// Report parsing errors only for lockfiles.
Some(err) if !maybe_manifest => return Err(err.into()),
_ => return Err(ParseError::ManifestWithoutGeneration(path)),
}
}

Expand Down

0 comments on commit 7d5aaba

Please sign in to comment.