Skip to content

Commit

Permalink
refactor: naming and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexD10S committed Dec 5, 2024
1 parent 0dce5f1 commit 3f60dcd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 4 additions & 4 deletions crates/pop-cli/src/commands/call/parachain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl CallParachainCommand {
};

// Send the extrinsic.
if let Err(e) = call.send_extrinsic(&chain.client, tx, &mut cli).await {
if let Err(e) = call.submit_extrinsic(&chain.client, tx, &mut cli).await {
display_message(&e.to_string(), false, &mut cli)?;
break;
}
Expand Down Expand Up @@ -253,7 +253,7 @@ impl CallParachain {
}

// Sign and submit an extrinsic.
async fn send_extrinsic(
async fn submit_extrinsic(
&mut self,
client: &OnlineClient<SubstrateConfig>,
tx: DynamicPayload,
Expand Down Expand Up @@ -625,7 +625,7 @@ mod tests {
}

#[tokio::test]
async fn user_cancel_send_extrinsic_works() -> Result<()> {
async fn user_cancel_submit_extrinsic_works() -> Result<()> {
let client = set_up_client("wss://rpc1.paseo.popnetwork.xyz").await?;
let pallets = parse_chain_metadata(&client).await?;
let mut call_config = CallParachain {
Expand All @@ -641,7 +641,7 @@ mod tests {
"Extrinsic remark was not submitted. Operation canceled by the user.",
);
let tx = call_config.prepare_extrinsic(&client, &mut cli).await?;
call_config.send_extrinsic(&client, tx, &mut cli).await?;
call_config.submit_extrinsic(&client, tx, &mut cli).await?;

cli.verify()
}
Expand Down
3 changes: 3 additions & 0 deletions crates/pop-common/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ pub enum Error {
Git(String),

Check warning on line 13 in crates/pop-common/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-common/src/errors.rs:13:2 | 13 | Git(String), | ^^^
#[error("IO error: {0}")]
IO(#[from] std::io::Error),

Check warning on line 15 in crates/pop-common/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-common/src/errors.rs:15:2 | 15 | IO(#[from] std::io::Error), | ^^
/// An error occurred while attempting to create a keypair from the provided URI.
#[error("Failed to create keypair from URI: {0}")]
KeyPairCreation(String),
#[error("Manifest error: {0}")]
ManifestError(#[from] cargo_toml::Error),

Check warning on line 20 in crates/pop-common/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-common/src/errors.rs:20:2 | 20 | ManifestError(#[from] cargo_toml::Error), | ^^^^^^^^^^^^^
/// An error occurred while attempting to retrieve the manifest path.
#[error("Failed to get manifest path: {0}")]
ManifestPath(String),
#[error("ParseError error: {0}")]
ParseError(#[from] url::ParseError),

Check warning on line 25 in crates/pop-common/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-common/src/errors.rs:25:2 | 25 | ParseError(#[from] url::ParseError), | ^^^^^^^^^^
/// An error occurred while parsing the provided secret URI.
#[error("Failed to parse secret URI: {0}")]
ParseSecretURI(String),
#[error("SourceError error: {0}")]
Expand Down
9 changes: 8 additions & 1 deletion crates/pop-parachains/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ pub enum Error {
Aborted,

Check warning on line 9 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:9:2 | 9 | Aborted, | ^^^^^^^
#[error("Anyhow error: {0}")]
AnyhowError(#[from] anyhow::Error),

Check warning on line 11 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:11:2 | 11 | AnyhowError(#[from] anyhow::Error), | ^^^^^^^^^^^
/// An error occurred while encoding the call data.
#[error("Failed to encode call data. {0}")]
CallDataEncodingError(String),
#[error("{0}")]
CommonError(#[from] pop_common::Error),

Check warning on line 16 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:16:2 | 16 | CommonError(#[from] pop_common::Error), | ^^^^^^^^^^^
/// An error occurred while attempting to establish a connection to the endpoint.
#[error("Failed to establish a connection to: {0}")]
ConnectionFailure(String),
#[error("Configuration error: {0}")]
Expand All @@ -21,15 +23,18 @@ pub enum Error {
CurrentDirAccess,

Check warning on line 23 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:23:2 | 23 | CurrentDirAccess, | ^^^^^^^^^^^^^^^^
#[error("Failed to parse the endowment value")]
EndowmentError,

Check warning on line 25 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:25:2 | 25 | EndowmentError, | ^^^^^^^^^^^^^^
/// The extrinsic is not supported.
#[error("The extrinsic is not supported")]
ExtrinsicNotSupported,
/// An error occurred during the submission of an extrinsic.
#[error("Extrinsic submission error: {0}")]
ExtrinsicSubmissionError(String),
#[error("IO error: {0}")]
IO(#[from] std::io::Error),

Check warning on line 33 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:33:2 | 33 | IO(#[from] std::io::Error), | ^^
#[error("JSON error: {0}")]
JsonError(#[from] serde_json::Error),

Check warning on line 35 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:35:2 | 35 | JsonError(#[from] serde_json::Error), | ^^^^^^^^^
#[error("Error parsing metadata for parameter {0} conversion")]
/// An error occurred while parsing metadata of a parameter.
#[error("Error parsing metadata for parameter {0}")]
MetadataParsingError(String),
#[error("Missing binary: {0}")]
MissingBinary(String),

Check warning on line 40 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:40:2 | 40 | MissingBinary(String), | ^^^^^^^^^^^^^
Expand All @@ -41,8 +46,10 @@ pub enum Error {
OrchestratorError(#[from] OrchestratorError),

Check warning on line 46 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:46:2 | 46 | OrchestratorError(#[from] OrchestratorError), | ^^^^^^^^^^^^^^^^^
#[error("Failed to create pallet directory")]
PalletDirCreation,

Check warning on line 48 in crates/pop-parachains/src/errors.rs

View workflow job for this annotation

GitHub Actions / clippy

missing documentation for a variant

warning: missing documentation for a variant --> crates/pop-parachains/src/errors.rs:48:2 | 48 | PalletDirCreation, | ^^^^^^^^^^^^^^^^^
/// The specified pallet could not be found.
#[error("Failed to find the pallet {0}")]
PalletNotFound(String),
/// An error occurred while processing the arguments provided by the user.
#[error("Failed to process the arguments provided by the user.")]
ParamProcessingError,
#[error("Invalid path")]
Expand Down

0 comments on commit 3f60dcd

Please sign in to comment.