diff --git a/crates/engine/src/cmd/mailings/recipients.rs b/crates/engine/src/cmd/mailings/recipients.rs index e9be3faf37..45aee66368 100644 --- a/crates/engine/src/cmd/mailings/recipients.rs +++ b/crates/engine/src/cmd/mailings/recipients.rs @@ -176,7 +176,7 @@ pub(super) fn recipients(s: &mut Session, v: &Value) -> CmdResult { } Pick::Index(0) } - Some(_) => return Err(CmdError::Params("`sheet` must be a sheet name or number".into())), + Some(_) => return Err(CmdError::Params("`sheet` must be a sheet name or positive integer (1 = the first sheet)".into())), }; let (names, rows) = read_rows(&bytes, pick).map_err(CmdError::Failed)?; let chosen = match pick { diff --git a/crates/engine/src/cmd/mailings/tests.rs b/crates/engine/src/cmd/mailings/tests.rs index 013200681e..f35774665c 100644 --- a/crates/engine/src/cmd/mailings/tests.rs +++ b/crates/engine/src/cmd/mailings/tests.rs @@ -242,7 +242,10 @@ fn recipients_from_a_workbook_ask_for_the_sheet_when_there_are_several() { assert_eq!(r["fields"], json!(["Column 1", "Column 2", "Column 3"])); assert_eq!(r["records"], 3); assert!(s.run("mailings.recipients", &json!({"data": data, "sheet": 3})).is_err()); - assert!(s.run("mailings.recipients", &json!({"data": data, "sheet": 0})).is_err()); + assert!(matches!( + s.run("mailings.recipients", &json!({"data": data, "sheet": 0})), + Err(CmdError::Params(message)) if message == "`sheet` must be a sheet name or positive integer (1 = the first sheet)" + )); assert!(s.run("mailings.recipients", &json!({"data": "%%%"})).is_err()); }