mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-30 21:17:25 +00:00
availability distribution: don't early return on runtime errors (#2606)
* availability distribution: don't early return on runtime errors * log error * extract runtime api error from Error * uh * oh
This commit is contained in:
@@ -33,7 +33,7 @@ use polkadot_primitives::v1::{
|
||||
use polkadot_subsystem::SubsystemContext;
|
||||
|
||||
use super::{
|
||||
error::{recv_runtime, Result},
|
||||
error::{recv_runtime, NonFatalError},
|
||||
Error,
|
||||
LOG_TARGET,
|
||||
};
|
||||
@@ -122,7 +122,7 @@ impl SessionCache {
|
||||
ctx: &mut Context,
|
||||
parent: Hash,
|
||||
with_info: F,
|
||||
) -> Result<Option<R>>
|
||||
) -> Result<Option<R>, NonFatalError>
|
||||
where
|
||||
Context: SubsystemContext,
|
||||
F: FnOnce(&SessionInfo) -> R,
|
||||
@@ -173,7 +173,7 @@ impl SessionCache {
|
||||
if let Err(err) = self.report_bad(report) {
|
||||
tracing::warn!(
|
||||
target: LOG_TARGET,
|
||||
err= ?err,
|
||||
err = ?err,
|
||||
"Reporting bad validators failed with error"
|
||||
);
|
||||
}
|
||||
@@ -184,7 +184,7 @@ impl SessionCache {
|
||||
/// We assume validators in a group are tried in reverse order, so the reported bad validators
|
||||
/// will be put at the beginning of the group.
|
||||
#[tracing::instrument(level = "trace", skip(self, report), fields(subsystem = LOG_TARGET))]
|
||||
pub fn report_bad(&mut self, report: BadValidators) -> Result<()> {
|
||||
pub fn report_bad(&mut self, report: BadValidators) -> super::Result<()> {
|
||||
let session = self
|
||||
.session_info_cache
|
||||
.get_mut(&report.session_index)
|
||||
@@ -219,7 +219,7 @@ impl SessionCache {
|
||||
ctx: &mut Context,
|
||||
parent: Hash,
|
||||
session_index: SessionIndex,
|
||||
) -> Result<Option<SessionInfo>>
|
||||
) -> Result<Option<SessionInfo>, NonFatalError>
|
||||
where
|
||||
Context: SubsystemContext,
|
||||
{
|
||||
@@ -230,7 +230,7 @@ impl SessionCache {
|
||||
..
|
||||
} = recv_runtime(request_session_info_ctx(parent, session_index, ctx).await)
|
||||
.await?
|
||||
.ok_or(Error::NoSuchSession(session_index))?;
|
||||
.ok_or(NonFatalError::NoSuchSession(session_index))?;
|
||||
|
||||
if let Some(our_index) = self.get_our_index(validators).await {
|
||||
// Get our group index:
|
||||
|
||||
Reference in New Issue
Block a user