Skip to content

Commit

Permalink
[fix] hyperledger-iroha#3337: Better error message for query find error
Browse files Browse the repository at this point in the history
Signed-off-by: Daniil Polyakov <[email protected]>
  • Loading branch information
Arjentix committed Sep 5, 2023
1 parent ed6c5cf commit e93aee1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 7 additions & 3 deletions client/tests/integration/triggers/by_call_trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ use std::{str::FromStr as _, sync::mpsc, thread, time::Duration};

use eyre::{eyre, Result, WrapErr};
use iroha_client::client::{self, Client};
use iroha_data_model::{prelude::*, query::error::FindError, trigger::OptimizedExecutable};
use iroha_data_model::{
prelude::*,
query::error::{FindError, QueryExecutionFail},
trigger::OptimizedExecutable,
};
use iroha_genesis::GenesisNetwork;
use iroha_logger::info;
use test_network::*;
Expand Down Expand Up @@ -198,8 +202,8 @@ fn trigger_should_not_be_executed_with_zero_repeats_count() -> Result<()> {
.chain()
.last()
.expect("At least two error causes expected")
.downcast_ref::<FindError>(),
Some(FindError::Trigger(id)) if *id == trigger_id
.downcast_ref::<QueryExecutionFail>(),
Some(QueryExecutionFail::Find(FindError::Trigger(id))) if *id == trigger_id
));

// Checking results
Expand Down
7 changes: 4 additions & 3 deletions data_model/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1472,8 +1472,9 @@ pub mod error {
#[skip_try_from]
String,
),
/// Query found nothing
Find(#[cfg_attr(feature = "std", source)] FindError),
/// {0}
#[cfg_attr(feature = "std", error(transparent))]
Find(FindError),
/// Query found wrong type of asset: {0}
Conversion(
#[skip_from]
Expand All @@ -1487,7 +1488,7 @@ pub mod error {
/// Type assertion error
#[derive(
Debug,
Display,
displaydoc::Display,
Clone,
PartialEq,
Eq,
Expand Down

0 comments on commit e93aee1

Please sign in to comment.