Skip to content

Commit

Permalink
Addressing comments commit wasn't pushed in (#9441)
Browse files Browse the repository at this point in the history
  • Loading branch information
albandum authored Dec 17, 2024
1 parent aaaaf5f commit f3fecb3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 29 deletions.
14 changes: 4 additions & 10 deletions connectors/src/connectors/snowflake/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,8 @@ export class SnowflakeConnectorManager extends BaseConnectorManager<null> {
const credentials = credentialsRes.value.credentials;

if (!isSnowflakeCredentials(credentials)) {
return new Err(
new ConnectorManagerError(
"INVALID_CONFIGURATION",
"Invalid credentials type - expected snowflake credentials"
)
throw new Error(
"Invalid credentials type - expected snowflake credentials"
);
}

Expand Down Expand Up @@ -281,11 +278,8 @@ export class SnowflakeConnectorManager extends BaseConnectorManager<null> {
}

if (!isSnowflakeCredentials(credentials)) {
return new Err(
new ConnectorManagerError(
"INVALID_CONFIGURATION",
"Invalid credentials type - expected snowflake credentials"
)
throw new Error(
"Invalid credentials type - expected snowflake credentials"
);
}

Expand Down
12 changes: 2 additions & 10 deletions connectors/src/connectors/snowflake/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,9 @@ export const getCredentials = async ({
// Narrow the type of credentials to just the username/password variant
const credentials = credentialsRes.value.credential.content;
if (!isSnowflakeCredentials(credentials)) {
logger.error(
{ credentialsId },
throw new Error(
"Invalid credentials type - expected snowflake credentials"
);
return new Err(
Error("Invalid credentials type - expected snowflake credentials")
);
}
return new Ok({
credentials,
Expand Down Expand Up @@ -105,13 +101,9 @@ export const getConnectorAndCredentials = async ({
// Narrow the type of credentials to just the username/password variant
const credentials = credentialsRes.value.credential.content;
if (!isSnowflakeCredentials(credentials)) {
logger.error(
{ connectorId },
throw new Error(
"Invalid credentials type - expected snowflake credentials"
);
return new Err(
Error("Invalid credentials type - expected snowflake credentials")
);
}
return new Ok({
connector,
Expand Down
9 changes: 5 additions & 4 deletions core/src/databases/remote_databases/get_remote_database.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{anyhow, Result};

use crate::{
databases::remote_databases::remote_database::RemoteDatabase,
Expand All @@ -17,8 +17,9 @@ pub async fn get_remote_database(
let db = SnowflakeRemoteDatabase::new(content)?;
Ok(Box::new(db) as Box<dyn RemoteDatabase + Sync + Send>)
}
_ => {
anyhow::bail!("{:?} is not a supported remote database provider", provider)
}
_ => Err(anyhow!(
"{:?} is not a supported remote database provider",
provider
))?,
}
}
7 changes: 2 additions & 5 deletions core/src/databases/remote_databases/remote_database.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use anyhow::Result;
use anyhow::{anyhow, Result};
use async_trait::async_trait;

use crate::{
Expand Down Expand Up @@ -35,9 +35,6 @@ pub async fn get_remote_database(
let db = SnowflakeRemoteDatabase::new(content)?;
Ok(Box::new(db) as Box<dyn RemoteDatabase + Sync + Send>)
}
_ => Err(anyhow::anyhow!(
"Provider {} is not a remote database",
provider
)),
_ => Err(anyhow!("Provider {} is not a remote database", provider)),
}
}

0 comments on commit f3fecb3

Please sign in to comment.