Remove unnecessary log statements.

This commit is contained in:
LukeMathWalker 2021-05-12 22:12:41 +01:00
parent 4e04ade2ed
commit 2b3dae3a6a
3 changed files with 6 additions and 21 deletions

View file

@ -146,11 +146,7 @@ pub async fn insert_subscriber(
Utc::now()
)
.execute(transaction)
.await
.map_err(|e| {
tracing::error!("Failed to execute query: {:?}", e);
e
})?;
.await?;
Ok(subscriber_id)
}
@ -173,10 +169,7 @@ pub async fn store_token(
)
.execute(transaction)
.await
.map_err(|e| {
tracing::error!("Failed to execute query: {:?}", e);
StoreTokenError(e)
})?;
.map_err(StoreTokenError)?;
Ok(())
}

View file

@ -34,11 +34,7 @@ pub async fn confirm_subscriber(pool: &PgPool, subscriber_id: Uuid) -> Result<()
subscriber_id,
)
.execute(pool)
.await
.map_err(|e| {
tracing::error!("Failed to execute query: {:?}", e);
e
})?;
.await?;
Ok(())
}
@ -52,10 +48,6 @@ pub async fn get_subscriber_id_from_token(
subscription_token,
)
.fetch_optional(pool)
.await
.map_err(|e| {
tracing::error!("Failed to execute query: {:?}", e);
e
})?;
.await?;
Ok(result.map(|r| r.subscriber_id))
}

View file

@ -47,13 +47,13 @@ async fn subscribe_fails_if_there_is_a_fatal_database_error() {
let app = spawn_app().await;
let body = "name=le%20guin&email=ursula_le_guin%40gmail.com";
// Sabotage the database
sqlx::query!("ALTER TABLE subscription_tokens DROP COLUMN subscription_token;",)
sqlx::query!("ALTER TABLE subscriptions DROP COLUMN email;",)
.execute(&app.db_pool)
.await
.unwrap();
// Act
let response = app.post_subscriptions(body.into()).await;
let response = app.post_subscriptions(body.into()).await;
// Assert
assert_eq!(response.status().as_u16(), 500);