mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-07 13:08:03 +00:00
don't wrap errors (#2830)
This commit is contained in:
@@ -242,9 +242,12 @@ impl RelayChainInterface for DummyRelayChainInterface {
|
||||
async fn header(&self, block_id: BlockId) -> RelayChainResult<Option<PHeader>> {
|
||||
let hash = match block_id {
|
||||
BlockId::Hash(hash) => hash,
|
||||
BlockId::Number(num) => self.relay_client.hash(num)?.ok_or_else(|| {
|
||||
RelayChainError::GenericError(format!("block with number {num} not found"))
|
||||
})?,
|
||||
BlockId::Number(num) =>
|
||||
if let Some(hash) = self.relay_client.hash(num)? {
|
||||
hash
|
||||
} else {
|
||||
return Ok(None)
|
||||
},
|
||||
};
|
||||
let header = self.relay_client.header(hash)?;
|
||||
|
||||
|
||||
@@ -94,9 +94,12 @@ impl RelayChainInterface for RelayChainInProcessInterface {
|
||||
async fn header(&self, block_id: BlockId) -> RelayChainResult<Option<PHeader>> {
|
||||
let hash = match block_id {
|
||||
BlockId::Hash(hash) => hash,
|
||||
BlockId::Number(num) => self.full_client.hash(num)?.ok_or_else(|| {
|
||||
RelayChainError::GenericError(format!("block with number {num} not found"))
|
||||
})?,
|
||||
BlockId::Number(num) =>
|
||||
if let Some(hash) = self.full_client.hash(num)? {
|
||||
hash
|
||||
} else {
|
||||
return Ok(None)
|
||||
},
|
||||
};
|
||||
let header = self.full_client.header(hash)?;
|
||||
|
||||
|
||||
@@ -82,9 +82,11 @@ impl RelayChainInterface for RelayChainRpcInterface {
|
||||
let hash = match block_id {
|
||||
BlockId::Hash(hash) => hash,
|
||||
BlockId::Number(num) =>
|
||||
self.rpc_client.chain_get_block_hash(Some(num)).await?.ok_or_else(|| {
|
||||
RelayChainError::GenericError(format!("block with number {num} not found"))
|
||||
})?,
|
||||
if let Some(hash) = self.rpc_client.chain_get_block_hash(Some(num)).await? {
|
||||
hash
|
||||
} else {
|
||||
return Ok(None)
|
||||
},
|
||||
};
|
||||
let header = self.rpc_client.chain_get_header(Some(hash)).await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user