Skip to content

Commit

Permalink
create an error module for the crate
Browse files Browse the repository at this point in the history
  • Loading branch information
brunopgalvao committed Apr 18, 2024
1 parent 3bcf5c5 commit 744c370
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
9 changes: 9 additions & 0 deletions crates/pop-contracts/src/errors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Error {
#[error("Failed to create new contract project: {0}")]
NewContractFailed(String),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
}
1 change: 1 addition & 0 deletions crates/pop-contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod new;
mod test;
mod up;
pub mod utils;
mod errors;

pub use build::build_smart_contract;
pub use call::{
Expand Down
10 changes: 1 addition & 9 deletions crates/pop-contracts/src/new.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
use contract_build::new_contract_project;
use std::path::Path;
use thiserror::Error;

#[derive(Error, Debug)]
pub enum Error {
#[error("Failed to create new contract project: {0}")]
NewContractFailed(String),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
}
use crate::errors::Error;

pub fn create_smart_contract(name: String, target: &Path) -> Result<(), Error> {
// Canonicalize the target path to ensure consistency and resolve any symbolic links.
Expand Down

0 comments on commit 744c370

Please sign in to comment.