Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions xtokens/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#![allow(clippy::unused_unit)]
#![allow(clippy::large_enum_variant)]

use frame_support::{pallet_prelude::*, require_transactional, traits::Get, transactional, Parameter};
use frame_support::{log, pallet_prelude::*, require_transactional, traits::Get, transactional, Parameter};
use frame_system::{ensure_signed, pallet_prelude::*};
use sp_runtime::{
traits::{AtLeast32BitUnsigned, Convert, MaybeSerializeDeserialize, Member, Zero},
Expand Down Expand Up @@ -54,6 +54,7 @@ use TransferKind::*;

#[frame_support::pallet]
pub mod module {

use super::*;

#[pallet::config]
Expand Down Expand Up @@ -120,6 +121,7 @@ pub mod module {
NotCrossChainTransferableCurrency,
/// The message's weight could not be determined.
UnweighableMessage,
// TODO: expand into XcmExecutionFailed(XcmError) after https://github.com/paritytech/substrate/pull/10242 done
/// XCM execution failed.
XcmExecutionFailed,
/// Could not re-anchor the assets to declare the fees for the
Expand Down Expand Up @@ -245,7 +247,10 @@ pub mod module {
let weight = T::Weigher::weight(&mut msg).map_err(|()| Error::<T>::UnweighableMessage)?;
T::XcmExecutor::execute_xcm_in_credit(origin_location, msg, weight, weight)
.ensure_complete()
.map_err(|_| Error::<T>::XcmExecutionFailed)?;
.map_err(|error| {
log::trace!("Failed execute transfer message with {:?}", error);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log::trace!("Failed execute transfer message with {:?}", error);
log::error!(target: "xtokens", "Failed execute transfer message with {:?}", error);

Error::<T>::XcmExecutionFailed
})?;

if deposit_event {
Self::deposit_event(Event::<T>::TransferredMultiAsset(who, asset, dest));
Expand Down
2 changes: 1 addition & 1 deletion xtokens/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn cannot_lost_fund_on_send_failed() {
),
40,
),
Error::<para::Runtime>::XcmExecutionFailed
Error::<para::Runtime>::XcmUnroutable
);

assert_eq!(ParaTokens::free_balance(CurrencyId::R, &ALICE), 1_000);
Expand Down