From 793bc1c2ae705126d2148ee87408816ec36f0c10 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 23 Aug 2023 10:06:01 +0200 Subject: [PATCH] Rename AcknowledgementMsg::Err to ::Error --- contracts/ibc-reflect-send/src/ibc.rs | 4 ++-- contracts/ibc-reflect-send/src/ibc_msg.rs | 7 +++---- contracts/ibc-reflect/src/contract.rs | 2 +- contracts/ibc-reflect/src/msg.rs | 7 +++---- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/contracts/ibc-reflect-send/src/ibc.rs b/contracts/ibc-reflect-send/src/ibc.rs index adede549eb..634fed3e81 100644 --- a/contracts/ibc-reflect-send/src/ibc.rs +++ b/contracts/ibc-reflect-send/src/ibc.rs @@ -146,7 +146,7 @@ fn acknowledge_who_am_i( // ignore errors (but mention in log) let WhoAmIResponse { account } = match ack { AcknowledgementMsg::Ok(res) => res, - AcknowledgementMsg::Err(e) => { + AcknowledgementMsg::Error(e) => { return Ok(IbcBasicResponse::new() .add_attribute("action", "acknowledge_who_am_i") .add_attribute("error", e)) @@ -176,7 +176,7 @@ fn acknowledge_balances( // ignore errors (but mention in log) let BalancesResponse { account, balances } = match ack { AcknowledgementMsg::Ok(res) => res, - AcknowledgementMsg::Err(e) => { + AcknowledgementMsg::Error(e) => { return Ok(IbcBasicResponse::new() .add_attribute("action", "acknowledge_balances") .add_attribute("error", e)) diff --git a/contracts/ibc-reflect-send/src/ibc_msg.rs b/contracts/ibc-reflect-send/src/ibc_msg.rs index 48f38406a4..ca6041218c 100644 --- a/contracts/ibc-reflect-send/src/ibc_msg.rs +++ b/contracts/ibc-reflect-send/src/ibc_msg.rs @@ -23,22 +23,21 @@ pub enum PacketMsg { #[cw_serde] pub enum AcknowledgementMsg { Ok(S), - #[serde(rename = "error")] - Err(String), + Error(String), } impl AcknowledgementMsg { pub fn unwrap(self) -> S { match self { AcknowledgementMsg::Ok(data) => data, - AcknowledgementMsg::Err(err) => panic!("{}", err), + AcknowledgementMsg::Error(err) => panic!("{}", err), } } pub fn unwrap_err(self) -> String { match self { AcknowledgementMsg::Ok(_) => panic!("not an error"), - AcknowledgementMsg::Err(err) => err, + AcknowledgementMsg::Error(err) => err, } } } diff --git a/contracts/ibc-reflect/src/contract.rs b/contracts/ibc-reflect/src/contract.rs index 23fa7046a3..1af5d90e91 100644 --- a/contracts/ibc-reflect/src/contract.rs +++ b/contracts/ibc-reflect/src/contract.rs @@ -224,7 +224,7 @@ pub fn migrate(_deps: DepsMut, _env: Env, _msg: Empty) -> StdResult { // this encode an error or error message into a proper acknowledgement to the recevier fn encode_ibc_error(msg: impl Into) -> Binary { // this cannot error, unwrap to keep the interface simple - to_binary(&AcknowledgementMsg::<()>::Err(msg.into())).unwrap() + to_binary(&AcknowledgementMsg::<()>::Error(msg.into())).unwrap() } #[entry_point] diff --git a/contracts/ibc-reflect/src/msg.rs b/contracts/ibc-reflect/src/msg.rs index 487e28edaa..6f72005f1c 100644 --- a/contracts/ibc-reflect/src/msg.rs +++ b/contracts/ibc-reflect/src/msg.rs @@ -62,22 +62,21 @@ pub enum PacketMsg { #[cw_serde] pub enum AcknowledgementMsg { Ok(S), - #[serde(rename = "error")] - Err(String), + Error(String), } impl AcknowledgementMsg { pub fn unwrap(self) -> S { match self { AcknowledgementMsg::Ok(data) => data, - AcknowledgementMsg::Err(err) => panic!("{}", err), + AcknowledgementMsg::Error(err) => panic!("{}", err), } } pub fn unwrap_err(self) -> String { match self { AcknowledgementMsg::Ok(_) => panic!("not an error"), - AcknowledgementMsg::Err(err) => err, + AcknowledgementMsg::Error(err) => err, } } }