mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 04:01:10 +00:00
addition error definitions (#2107)
* remove low information density error doc comments * another round of error dancing * fix compilation * remove stale `None` argument * adjust test, minor slip in command * only add AvailabilityError for full node features * another None where none shuld be
This commit is contained in:
committed by
GitHub
parent
418f38c335
commit
35c71bf315
@@ -44,7 +44,6 @@ use polkadot_node_subsystem_util::metrics::{self, prometheus};
|
||||
use polkadot_subsystem::messages::{
|
||||
AllMessages, AvailabilityStoreMessage, ChainApiMessage, RuntimeApiMessage, RuntimeApiRequest,
|
||||
};
|
||||
use thiserror::Error;
|
||||
|
||||
const LOG_TARGET: &str = "availability";
|
||||
|
||||
@@ -54,22 +53,32 @@ mod columns {
|
||||
pub const NUM_COLUMNS: u32 = 2;
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
enum Error {
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
RuntimeApi(#[from] RuntimeApiError),
|
||||
|
||||
#[error(transparent)]
|
||||
ChainApi(#[from] ChainApiError),
|
||||
|
||||
#[error(transparent)]
|
||||
Erasure(#[from] erasure::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
Io(#[from] io::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
Oneshot(#[from] oneshot::Canceled),
|
||||
|
||||
#[error(transparent)]
|
||||
Subsystem(#[from] SubsystemError),
|
||||
|
||||
#[error(transparent)]
|
||||
Time(#[from] SystemTimeError),
|
||||
|
||||
#[error("Custom databases are not supported")]
|
||||
CustomDatabase,
|
||||
}
|
||||
|
||||
impl Error {
|
||||
@@ -418,10 +427,10 @@ pub struct Config {
|
||||
}
|
||||
|
||||
impl std::convert::TryFrom<sc_service::config::DatabaseConfig> for Config {
|
||||
type Error = &'static str;
|
||||
type Error = Error;
|
||||
|
||||
fn try_from(config: sc_service::config::DatabaseConfig) -> Result<Self, Self::Error> {
|
||||
let path = config.path().ok_or("custom databases are not supported")?;
|
||||
let path = config.path().ok_or(Error::CustomDatabase)?;
|
||||
|
||||
Ok(Self {
|
||||
// substrate cache size is improper here; just use the default
|
||||
|
||||
@@ -35,7 +35,6 @@ use polkadot_node_subsystem_util::{
|
||||
use polkadot_primitives::v1::{AvailabilityBitfield, CoreState, Hash, ValidatorIndex};
|
||||
use std::{pin::Pin, time::Duration, iter::FromIterator};
|
||||
use wasm_timer::{Delay, Instant};
|
||||
use thiserror::Error;
|
||||
|
||||
/// Delay between starting a bitfield signing job and its attempting to create a bitfield.
|
||||
const JOB_DELAY: Duration = Duration::from_millis(1500);
|
||||
@@ -45,24 +44,24 @@ const LOG_TARGET: &str = "bitfield_signing";
|
||||
pub struct BitfieldSigningJob;
|
||||
|
||||
/// Errors we may encounter in the course of executing the `BitfieldSigningSubsystem`.
|
||||
#[derive(Debug, Error)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum Error {
|
||||
/// error propagated from the utility subsystem
|
||||
#[error(transparent)]
|
||||
Util(#[from] util::Error),
|
||||
/// io error
|
||||
|
||||
#[error(transparent)]
|
||||
Io(#[from] std::io::Error),
|
||||
/// a one shot channel was canceled
|
||||
|
||||
#[error(transparent)]
|
||||
Oneshot(#[from] oneshot::Canceled),
|
||||
/// a mspc channel failed to send
|
||||
|
||||
#[error(transparent)]
|
||||
MpscSend(#[from] mpsc::SendError),
|
||||
/// the runtime API failed to return what we wanted
|
||||
|
||||
#[error(transparent)]
|
||||
Runtime(#[from] RuntimeApiError),
|
||||
/// the keystore failed to process signing request
|
||||
|
||||
#[error("Keystore failed: {0:?}")]
|
||||
Keystore(KeystoreError),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user