pop_common/
errors.rs

1// SPDX-License-Identifier: GPL-3.0
2
3use crate::{sourcing, templates};
4use thiserror::Error;
5
6/// Represents the various errors that can occur in the crate.
7#[derive(Error, Debug)]
8pub enum Error {
9	/// An error occurred while parsing the provided account address.
10	#[error("Failed to parse account address: {0}")]
11	AccountAddressParsing(String),
12	/// An error occurred.
13	#[error("Anyhow error: {0}")]
14	AnyhowError(#[from] anyhow::Error),
15	/// A configuration error occurred.
16	#[error("Configuration error: {0}")]
17	Config(String),
18	/// A Git error occurred.
19	#[error("a git error occurred: {0}")]
20	Git(String),
21	/// An IO error occurred.
22	#[error("IO error: {0}")]
23	IO(#[from] std::io::Error),
24	/// An error occurred while attempting to create a keypair from the provided URI.
25	#[error("Failed to create keypair from URI: {0}")]
26	KeyPairCreation(String),
27	/// A manifest error occurred.
28	#[error("Manifest error: {0}")]
29	ManifestError(#[from] cargo_toml::Error),
30	/// An error occurred while attempting to retrieve the manifest path.
31	#[error("Failed to get manifest path: {0}")]
32	ManifestPath(String),
33	/// An error occurred during parsing.
34	#[error("ParseError error: {0}")]
35	ParseError(#[from] url::ParseError),
36	/// An error occurred while parsing the provided secret URI.
37	#[error("Failed to parse secret URI: {0}")]
38	ParseSecretURI(String),
39	/// An error occurred during sourcing of a binary.
40	#[error("SourceError error: {0}")]
41	SourceError(#[from] sourcing::Error),
42	/// A template error occurred.
43	#[error("TemplateError error: {0}")]
44	TemplateError(#[from] templates::Error),
45	/// An error occurred while executing a test command.
46	#[error("Failed to execute test command: {0}")]
47	TestCommand(String),
48	/// The command is unsupported.
49	#[error("Unsupported command: {0}")]
50	UnsupportedCommand(String),
51	/// The platform is unsupported.
52	#[error("Unsupported platform: {arch} {os}")]
53	UnsupportedPlatform {
54		/// The architecture of the CPU that is currently in use.
55		arch: &'static str,
56		/// The operating system in use.
57		os: &'static str,
58	},
59}