|
1 |
| -use serde::{de::DeserializeOwned, Serialize}; |
| 1 | +use serde::{de::DeserializeOwned, Deserialize, Serialize}; |
2 | 2 | use std::marker::PhantomData;
|
3 | 3 | use std::ops::Deref;
|
4 | 4 |
|
@@ -208,8 +208,17 @@ pub trait Api {
|
208 | 208 | fn ed25519_sign(&self, message: &[u8], private_key: &[u8]) -> Result<Vec<u8>, SigningError>;
|
209 | 209 | }
|
210 | 210 |
|
| 211 | +#[derive(Debug, Serialize, Deserialize, PartialEq)] |
| 212 | +#[serde(rename_all = "snake_case")] |
| 213 | +#[non_exhaustive] |
| 214 | + |
| 215 | +pub enum LegacyQueryResult { |
| 216 | + /// Whenever there is no specific error type available |
| 217 | + GenericErr { msg: String }, |
| 218 | +} |
| 219 | + |
211 | 220 | /// A short-hand alias for the two-level query result (1. accessing the contract, 2. executing query in the contract)
|
212 |
| -pub type QuerierResult = SystemResult<ContractResult<Binary>>; |
| 221 | +pub type QuerierResult = SystemResult<ContractResult<Binary, LegacyQueryResult>>; |
213 | 222 |
|
214 | 223 | pub trait Querier {
|
215 | 224 | /// raw_query is all that must be implemented for the Querier.
|
@@ -265,7 +274,7 @@ impl<'a, C: CustomQuery> QuerierWrapper<'a, C> {
|
265 | 274 | system_err
|
266 | 275 | ))),
|
267 | 276 | SystemResult::Ok(ContractResult::Err(contract_err)) => Err(StdError::generic_err(
|
268 |
| - format!("Querier contract error: {}", contract_err), |
| 277 | + format!("Querier contract error: {:?}", contract_err), |
269 | 278 | )),
|
270 | 279 | SystemResult::Ok(ContractResult::Ok(value)) => from_binary(&value),
|
271 | 280 | }
|
|
0 commit comments