various: replace silent error discards with logged warnings
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I465d760b5330980270b64b4a89abc09f6a6a6964
This commit is contained in:
parent
9bbc1754d9
commit
38ed7faee2
7 changed files with 147 additions and 40 deletions
|
|
@ -175,12 +175,22 @@ pub async fn auto_promote_if_complete(
|
|||
.map_err(CiError::Database)?;
|
||||
|
||||
for channel in channels {
|
||||
let _ = promote(pool, channel.id, evaluation_id).await;
|
||||
tracing::info!(
|
||||
channel = %channel.name,
|
||||
evaluation_id = %evaluation_id,
|
||||
"Auto-promoted evaluation to channel"
|
||||
);
|
||||
match promote(pool, channel.id, evaluation_id).await {
|
||||
Ok(_) => {
|
||||
tracing::info!(
|
||||
channel = %channel.name,
|
||||
evaluation_id = %evaluation_id,
|
||||
"Auto-promoted evaluation to channel"
|
||||
);
|
||||
},
|
||||
Err(e) => {
|
||||
tracing::warn!(
|
||||
channel = %channel.name,
|
||||
evaluation_id = %evaluation_id,
|
||||
"Failed to auto-promote channel: {e}"
|
||||
);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -109,11 +109,14 @@ pub async fn authenticate(
|
|||
if let Some(ref hash) = user.password_hash {
|
||||
if verify_password(&creds.password, hash)? {
|
||||
// Update last login time
|
||||
let _ =
|
||||
if let Err(e) =
|
||||
sqlx::query("UPDATE users SET last_login_at = NOW() WHERE id = $1")
|
||||
.bind(user.id)
|
||||
.execute(pool)
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
tracing::warn!(user_id = %user.id, "Failed to update last_login_at: {e}");
|
||||
}
|
||||
Ok(user)
|
||||
} else {
|
||||
Err(CiError::Unauthorized("Invalid credentials".to_string()))
|
||||
|
|
@ -442,13 +445,16 @@ pub async fn validate_session(
|
|||
|
||||
// Update last_used_at
|
||||
if result.is_some() {
|
||||
let _ = sqlx::query(
|
||||
if let Err(e) = sqlx::query(
|
||||
"UPDATE user_sessions SET last_used_at = NOW() WHERE session_token_hash \
|
||||
= $1",
|
||||
)
|
||||
.bind(&token_hash)
|
||||
.execute(pool)
|
||||
.await;
|
||||
.await
|
||||
{
|
||||
tracing::warn!("Failed to update session last_used_at: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(result)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue