Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 committed Dec 18, 2024
1 parent 76d6359 commit aae3f0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ reqwest = { version = "0.12.5", default-features = false, features = [
sentry = { version = "0.32", default-features = false, features = [
"reqwest",
"rustls",
], optional = true }
] }
sentry-anyhow = "0.32"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
21 changes: 6 additions & 15 deletions core/src/smtp/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,15 @@ use thiserror::Error;

#[derive(Debug, Error, Serialize)]
pub enum HeadlessError {
#[serde(serialize_with = "ser_with_display")]
#[error("Fantoccini error: {0}")]
Fantoccini(#[from] std::io::Error),
#[serde(serialize_with = "ser_with_display")]
#[error("Cmd error: {0}")]
Cmd(CmdError),
Cmd(#[from] CmdError),
#[serde(serialize_with = "ser_with_display")]
#[error("New session error: {0}")]
NewSession(NewSessionError),
}

impl From<CmdError> for HeadlessError {
fn from(e: CmdError) -> Self {
Self::Cmd(e)
}
}

impl From<NewSessionError> for HeadlessError {
fn from(e: NewSessionError) -> Self {
Self::NewSession(e)
}
NewSession(#[from] NewSessionError),
}

pub async fn create_headless_client(webdriver: &str) -> Result<Client, HeadlessError> {
Expand All @@ -62,7 +53,7 @@ pub async fn create_headless_client(webdriver: &str) -> Result<Client, HeadlessE
caps.insert("goog:chromeOptions".to_string(), opts);

// Connect to WebDriver instance that is listening on `webdriver`
let c = ClientBuilder::native()
let c = ClientBuilder::rustls()?
.capabilities(caps)
.connect(webdriver)
.await?;
Expand Down

0 comments on commit aae3f0c

Please sign in to comment.