1use pop_common::sourcing::Error as SourcingError;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8#[allow(clippy::enum_variant_names)]
9pub enum Error {
10 #[error("Anyhow error: {0}")]
12 AnyhowError(#[from] anyhow::Error),
13 #[error("Failed to parse balance: {0}")]
15 BalanceParsing(String),
16 #[error("{0}")]
18 CallContractError(String),
19 #[error("{0}")]
21 ContractMetadata(String),
22 #[error("{0}")]
24 CommonError(#[from] pop_common::Error),
25 #[error("Pre-submission dry-run failed: {0}")]
27 DryRunUploadContractError(String),
28 #[error("Pre-submission dry-run failed: {0}")]
30 DryRunCallContractError(String),
31 #[error("Failed to parse hex encoded bytes: {0}")]
33 HexParsing(String),
34 #[error("HTTP error: {0}")]
36 HttpError(#[from] reqwest::Error),
37 #[error("Incorrect number of arguments provided. Expecting {expected}, {provided} provided")]
39 IncorrectArguments {
40 expected: usize,
42 provided: usize,
44 },
45 #[error("Failed to install {0}")]
47 InstallContractsNode(String),
48 #[error("{0}")]
50 InstantiateContractError(String),
51 #[error("Invalid constructor name: {0}")]
53 InvalidConstructorName(String),
54 #[error("Invalid message name: {0}")]
56 InvalidMessageName(String),
57 #[error("Invalid name: {0}")]
59 InvalidName(String),
60 #[error("Invalid toolchain: {0}")]
62 InvalidToolchain(String),
63 #[error("IO error: {0}")]
65 IO(#[from] std::io::Error),
66 #[error("Failed to get manifest path: {0}")]
68 ManifestPath(String),
69 #[error("Failed to map account: {0}")]
71 MapAccountError(String),
72 #[error("Argument {0} is required")]
74 MissingArgument(String),
75 #[error("Failed to create new contract project: {0}")]
77 NewContract(String),
78 #[error("ParseError error: {0}")]
80 ParseError(#[from] url::ParseError),
81 #[error("The `Repository` property is missing from the template variant")]
83 RepositoryMissing,
84 #[error("Serde JSON error: {0}")]
86 SerdeJson(#[from] serde_json::Error),
87 #[error("Sourcing error {0}")]
89 SourcingError(SourcingError),
90 #[error("Failed to execute test command: {0}")]
92 TestCommand(String),
93 #[error("Unsupported platform: {os}")]
95 UnsupportedPlatform {
96 os: &'static str,
98 },
99 #[error("{0}")]
101 UploadContractError(String),
102 #[error("{0}")]
104 Verification(String),
105}