Skip to content

Commit

Permalink
Makes the 'Failed to resolve' error message clearer
Browse files Browse the repository at this point in the history
Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
  • Loading branch information
dcookspi committed Aug 7, 2024
1 parent e25d2bd commit 2efb846
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions crates/spk-solve/crates/graph/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ impl FormatError for Error {
match self {
Error::FailedToResolve(_graph) => {
// TODO: provide a summary based on the graph
msg.push_str(
": there is no solution for these requests using the available packages",
);
}
Error::SolverError(reason) => {
msg.push_str("\n * ");
Expand Down
2 changes: 1 addition & 1 deletion crates/spk-solve/crates/graph/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ impl<'state, 'cmpt> DecisionBuilder<'state, 'cmpt> {
}

#[derive(Clone, Debug, Diagnostic, Error)]
#[error("Failed to resolve")]
#[error("Failed to resolve: there is no solution for these requests using the available packages")]
pub struct Graph {
pub root: Arc<tokio::sync::RwLock<Arc<Node>>>,
pub nodes: HashMap<u64, Arc<tokio::sync::RwLock<Arc<Node>>>>,
Expand Down
3 changes: 3 additions & 0 deletions crates/spk-solve/crates/validation/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ impl FormatError for Error {
match self {
Error::FailedToResolve(_graph) => {
// TODO: provide a summary based on the graph
msg.push_str(
": there is no solution for these requests using the available packages",
);
}
Error::SolverError(reason) => {
msg.push_str("\n * ");
Expand Down
2 changes: 1 addition & 1 deletion crates/spk-solve/src/solver_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ async fn test_solver_build_from_source_unsolvable(mut solver: Solver) {
let msg = strip_ansi_escapes::strip(msg);
let msg = String::from_utf8_lossy(&msg);
msg.ends_with(
"TRY my-tool/1.2.0/src - cannot resolve build env for source build: Failed to resolve",
"TRY my-tool/1.2.0/src - cannot resolve build env for source build: Failed to resolve: there is no solution for these requests using the available packages",
)
});
assert!(
Expand Down

0 comments on commit 2efb846

Please sign in to comment.