polkadot_collator_protocol/collator_side/
error.rs1use polkadot_node_network_protocol::request_response::incoming;
18use polkadot_node_primitives::UncheckedSignedFullStatement;
19use polkadot_node_subsystem::{errors::SubsystemError, RuntimeApiError};
20use polkadot_node_subsystem_util::{backing_implicit_view, runtime};
21
22use crate::LOG_TARGET;
23
24pub type Result<T> = std::result::Result<T, Error>;
26
27use fatality::Nested;
28
29#[allow(missing_docs)]
30#[fatality::fatality(splitable)]
31pub enum Error {
32 #[fatal]
33 #[error("Receiving message from overseer failed")]
34 SubsystemReceive(#[from] SubsystemError),
35
36 #[fatal(forward)]
37 #[error("Retrieving next incoming request failed")]
38 IncomingRequest(#[from] incoming::Error),
39
40 #[fatal(forward)]
41 #[error("Error while accessing runtime information")]
42 Runtime(#[from] runtime::Error),
43
44 #[error("Error while accessing Runtime API")]
45 RuntimeApi(#[from] RuntimeApiError),
46
47 #[error(transparent)]
48 ImplicitViewFetchError(backing_implicit_view::FetchError),
49
50 #[error("CollationSeconded contained statement with invalid signature")]
51 InvalidStatementSignature(UncheckedSignedFullStatement),
52}
53
54pub fn log_error(result: Result<()>, ctx: &'static str) -> std::result::Result<(), FatalError> {
59 match result.into_nested()? {
60 Ok(()) => Ok(()),
61 Err(jfyi) => {
62 gum::warn!(target: LOG_TARGET, error = ?jfyi, ctx);
63 Ok(())
64 },
65 }
66}