Skip to content

Commit f5d4b2a

Browse files
authored
Merge pull request #1048 from victorisiguzoruzoma874/fix/db-error-sanitization-914
fix(api): sanitize database constraint errors before sending to clients
2 parents 63fb2d1 + c382cd5 commit f5d4b2a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

services/api/src/handlers.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ fn into_api_error(err: anyhow::Error) -> ApiError {
9292
return ApiError::service_unavailable("database connection pool exhausted");
9393
}
9494
DbError::ConstraintViolation(msg) => {
95-
return ApiError::conflict(msg.clone());
95+
tracing::error!(db_constraint = %msg, "database constraint violation");
96+
return ApiError::conflict("A record with this value already exists.");
9697
}
9798
DbError::Other(_) => {}
9899
}

0 commit comments

Comments
 (0)