use polkadot_sdk::*;
use alloc::string::ToString;
use codec::{Decode, DecodeWithMemTracking, Encode};
use sp_core::ConstU32;
use sp_runtime::BoundedVec;
use sp_std::prelude::*;
#[derive(
Clone, Debug, Encode, Decode, DecodeWithMemTracking, scale_info::TypeInfo, PartialEq, Eq,
)]
#[allow(missing_docs)]
pub struct HandlingError {
message: BoundedVec<u8, ConstU32<1000>>,
}
impl From<anyhow::Error> for HandlingError {
fn from(value: anyhow::Error) -> Self {
let mut message = value.to_string().as_bytes().to_vec();
message.truncate(1000);
Self { message: message.try_into().unwrap_or_default() }
}
}