Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
error handling
  • Loading branch information
gpestana committed Jan 8, 2023
commit a0e21bdbf1af751e0b3908816414c0ad45bb641a
14 changes: 10 additions & 4 deletions frame/staking/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,20 @@ where
let api = self.client.runtime_api();
let at = BlockId::hash(self.client.info().best_hash);

let runtime_api_result = api.query_points_to_balance(&at, pool_id);

runtime_api_result.map_err(|e| {
api.query_points_to_balance(&at, pool_id).map_err(|e| {
CallError::Custom(ErrorObject::owned(
Error::RuntimeError.into(),
"Unable to query the points to balance conversion for pool.",
Some(e.to_string()),
))
})?
}).and_then(|r| {
r.map_err(|e| {
CallError::Custom(ErrorObject::owned(
Error::RuntimeError.into(),
"Unable to query the points to balance conversion for pool.",
Some(e.to_string()),
))
})?
})
}
}