From 6bffa4e4f5da48b2ff82d3c6223fafb78c4c17f7 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Fri, 2 Feb 2024 17:47:09 +0100 Subject: [PATCH 1/2] Improve error message for expected String --- crates/transcode/src/encode.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/transcode/src/encode.rs b/crates/transcode/src/encode.rs index 32bbf4cec..709e47d09 100644 --- a/crates/transcode/src/encode.rs +++ b/crates/transcode/src/encode.rs @@ -284,7 +284,9 @@ impl<'a> Encoder<'a> { s.encode_to(output); Ok(()) } else { - Err(anyhow::anyhow!("Expected a String value")) + Err(anyhow::anyhow!("Expected a String value\n\ + On the command-line, String values need to be wrapped in escaped quotes: \ + \\\"…\\\".")) } } TypeDefPrimitive::U8 => encode_uint::(value, "u8", output), From d975a91d4bb197a0677074c5528db4f0fc77fa0c Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Fri, 2 Feb 2024 17:56:45 +0100 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a7f8776b..41f25c56e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Improved error message for Strings as CLI arguments - [#1492](https://github.com/paritytech/cargo-contract/pull/1492) - Add a user-friendly view of contract storage data in the form of a table - [#1414](https://github.com/paritytech/cargo-contract/pull/1414) - Add `rpc` command - [#1458](https://github.com/paritytech/cargo-contract/pull/1458)