jam_tooling/
error.rs

1use codec::Error as CodecError;
2
3#[derive(Debug, thiserror::Error)]
4pub enum SegRootError {
5	#[error("No exporting packages reported")]
6	NoExportingPackagesReported,
7	#[error("No block at given slot")]
8	NoBlockAtGivenSlot,
9	#[error("Core not exporting")]
10	CoreNotExporting,
11}
12
13// The composite error type for PolkaJAM tooling.
14#[derive(Debug, thiserror::Error)]
15pub enum Error {
16	#[error("Service not found")]
17	ServiceNotFound,
18	#[error("Bootstrap service not found")]
19	BootstrapServiceNotFound,
20	#[error("Code of the Bootstrap service not found")]
21	BootstrapServiceCodeNotFound,
22	#[error("Bootstrap service has no metadata")]
23	InvalidBootstrapMetadata,
24	#[error("Invalid `Service` type encoding: {0}")]
25	InvalidServiceEncoding(CodecError),
26	#[error("Unknown command")]
27	UnknownCommand,
28	#[error("Could not parse hash")]
29	CouldNotParseHash,
30	#[error("Could not parse auth queue")]
31	CouldNotParseAuthQueue,
32	#[error("Could not parse pair")]
33	CouldNotParsePair,
34	#[error("Could not parse array")]
35	CouldNotParseArray,
36	#[error("Value too large")]
37	ValueTooLarge,
38	#[error("No pending work item")]
39	NoPendingWorkItem,
40	#[error("No authorization available")]
41	NoAuthorizationAvailable,
42	#[error("Segment root parse error: {0}")]
43	CouldNotParseSegRoot(#[from] SegRootError),
44	#[error("I/O error: {0}")]
45	Io(#[from] std::io::Error),
46	#[error("Integer parse error: {0}")]
47	ParseInt(#[from] std::num::ParseIntError),
48	#[error("Hex parse error: {0}")]
49	HexParse(#[from] hex::FromHexError),
50}