From 20742d9878c63f4b6ed224898917885acf3ae7bb Mon Sep 17 00:00:00 2001 From: "tien.xuan.vo" Date: Wed, 7 Feb 2024 09:58:13 +0700 Subject: [PATCH] feat: Rephrase the content type matching error message --- rust/pact_matching/src/json.rs | 2 +- rust/pact_matching/src/matchingrules.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/pact_matching/src/json.rs b/rust/pact_matching/src/json.rs index ff08bff96..a95815328 100644 --- a/rust/pact_matching/src/json.rs +++ b/rust/pact_matching/src/json.rs @@ -257,7 +257,7 @@ impl Matches<&Value> for Value { }, MatchingRule::ContentType(ref expected_content_type) => { match_content_type(&convert_data(actual), expected_content_type) - .map_err(|err| anyhow!("Expected data to have a content type of '{}' but was {}", expected_content_type, err)) + .map_err(|err| anyhow!("Failed to match data to have a content type of '{}': {}", expected_content_type, err)) } MatchingRule::Boolean => match actual { Value::Bool(_) => Ok(()), diff --git a/rust/pact_matching/src/matchingrules.rs b/rust/pact_matching/src/matchingrules.rs index 3eb51e3c5..93b631630 100644 --- a/rust/pact_matching/src/matchingrules.rs +++ b/rust/pact_matching/src/matchingrules.rs @@ -148,7 +148,7 @@ impl Matches<&[u8]> for Vec { } MatchingRule::ContentType(ref expected_content_type) => { match_content_type(actual, expected_content_type) - .map_err(|err| anyhow!("Expected data to have a content type of '{}' but was {}", expected_content_type, err)) + .map_err(|err| anyhow!("Failed to match data to have a content type of '{}': {}", expected_content_type, err)) } MatchingRule::NotEmpty => { if actual.is_empty() {