Skip to content

Commit

Permalink
added error case, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
clriesco committed Apr 29, 2024
1 parent 48a534a commit b5d1509
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 29 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion fplus-database/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "fplus-database"
authors = ["clriesco", "kokal33", "alexmcon"]
version = "1.8.1"
version = "1.8.2"
edition = "2021"
description = "FPlus main database module"
license = "MIT OR Apache-2.0"
Expand Down
6 changes: 3 additions & 3 deletions fplus-http-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "fplus-http-server"
authors = ["jbesraa", "kokal33", "clriesco"]
version = "1.8.1"
version = "1.8.2"
description = "FPlus main http module"
license = "MIT OR Apache-2.0"
edition = "2021"
Expand All @@ -22,8 +22,8 @@ actix-cors = "0.6.4"
reqwest = { version = "0.11.18", features = ["json"] }
futures = "0.3.28"
dotenv = "0.15.0"
fplus-lib = { path = "../fplus-lib", version = "1.8.1" }
fplus-database = { path = "../fplus-database", version = "1.8.1"}
fplus-lib = { path = "../fplus-lib", version = "1.8.2" }
fplus-database = { path = "../fplus-database", version = "1.8.2"}
anyhow = "1.0.75"
async-trait = "0.1.73"
uuidv4 = "1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions fplus-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "fplus-lib"
authors = ["jbesraa", "kokal33", "clriesco"]
version = "1.8.1"
version = "1.8.2"
edition = "2021"
description = "FPlus library/helper files"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -30,6 +30,6 @@ uuidv4 = "1.0.0"
rayon = "1.8.0"
log = "0.4.20"
once_cell = "1.19.0"
fplus-database = { path = "../fplus-database", version = "1.8.1"}
fplus-database = { path = "../fplus-database", version = "1.8.2"}
pem = "1.0"
anyhow = "1.0"
42 changes: 22 additions & 20 deletions fplus-lib/src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,26 +668,28 @@ impl LDNApplication {
Ok(_) => {
log::info!("Allowance not found or is zero");
},
Err(_ ) => {
//If error contains

// Self::add_error_label(
// issue_number.clone(),
// "".to_string(),
// info.owner.clone(),
// info.repo.clone(),
// ).await?;

// Self::add_comment_to_issue(
// issue_number.clone(),
// info.owner.clone(),
// info.repo.clone(),
// "Unable to access blockchain data for your address. Please contact support.".to_string(),
// ).await?;

// return Err(LDNError::New(
// "Error getting allowance for address. Unable to access blockchain".to_string(),
// ));
Err(e) => {
//If error contains "DMOB api", add error label and comment to issue
if e.to_string().contains("DMOB api") {
log::error!("Error getting allowance for address. Unable to access blockchain data");
Self::add_error_label(
issue_number.clone(),
"".to_string(),
info.owner.clone(),
info.repo.clone(),
).await?;

Self::add_comment_to_issue(
issue_number.clone(),
info.owner.clone(),
info.repo.clone(),
"Unable to access blockchain data for your address. Please contact support.".to_string(),
).await?;

return Err(LDNError::New(
"Error getting allowance for address. Unable to access blockchain".to_string(),
));
}
},
}
}
Expand Down
9 changes: 9 additions & 0 deletions fplus-lib/src/external_services/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ pub enum BlockchainDataError {
Err(String),
}

//Implement Display for BlockchainDataError
impl std::fmt::Display for BlockchainDataError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
BlockchainDataError::Err(e) => write!(f, "Error: {}", e),
}
}
}

impl BlockchainData {
/// Setup new BlockchainData client.
pub fn new() -> Self {
Expand Down

0 comments on commit b5d1509

Please sign in to comment.