diff --git a/server/src/database.rs b/server/src/database.rs index fb01b3d..b4b3c24 100644 --- a/server/src/database.rs +++ b/server/src/database.rs @@ -5,14 +5,14 @@ pub mod transactions; #[derive(Debug, thiserror::Error)] pub enum DatabaseError { - #[error("Foreign key violation ({constraint}): {source}")] + #[error("foreign key violation ({constraint}): {source}")] ForeignKeyViolation { constraint: Constraint, #[source] source: sqlx::Error, }, - #[error("Internal error: {0}")] + #[error("internal error: {0}")] Internal(#[source] sqlx::Error), } @@ -37,13 +37,13 @@ impl From for DatabaseError { #[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] pub enum Constraint { - #[error("Recurring transaction source account constraint violation")] + #[error("recurring transaction source account constraint violation")] RecurringTransactionSourceAccount, - #[error("Recurring transaction destination account constraint violation")] + #[error("recurring transaction destination account constraint violation")] RecurringTransactionDestinationAccount, - #[error("Unknown constraint violation: {0:?}")] + #[error("unknown constraint violation: {0:?}")] Unknown(Option), } diff --git a/server/src/error.rs b/server/src/error.rs index a9cf08d..85a0847 100644 --- a/server/src/error.rs +++ b/server/src/error.rs @@ -36,10 +36,10 @@ impl IntoResponse for AppError { return error_response(StatusCode::UNPROCESSABLE_ENTITY, error.to_string()); } Self::Repository(RepositoryError::Database(error)) => { - tracing::error!(%error, "Database query failed"); + tracing::error!(%error, "database query failed"); } Self::Repository(RepositoryError::Decode(error)) => { - tracing::error!(%error, "Invalid stored data"); + tracing::error!(%error, "invalid stored data"); } Self::Repository(RepositoryError::ReferenceViolation { relation: ReferenceRelation::SourceAccount, @@ -76,7 +76,7 @@ impl IntoResponse for AppError { kind, source, }) => { - tracing::error!(%relation, %kind, error = ?source, "Unhandled reference violation"); + tracing::error!(%relation, %kind, error = ?source, "unhandled reference violation"); } Self::Repository(RepositoryError::QueryConversion(error)) => { return error_response(StatusCode::BAD_REQUEST, error.to_string()); diff --git a/server/src/main.rs b/server/src/main.rs index 18c7863..10819de 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -24,24 +24,24 @@ async fn main() -> anyhow::Result<()> { .max_connections(5) .connect(&database_url) .await - .context("Failed to connect to database")?; + .context("failed to connect to database")?; sqlx::migrate!() .run(&pool) .await - .context("Failed to run database migrations")?; + .context("failed to run database migrations")?; let host = env::var("HOST").context("HOST must be set")?; let port = env::var("PORT").context("PORT must be set")?; let addr = format!("{}:{}", host, port); let listener = TcpListener::bind(&addr) .await - .context(format!("Failed to bind to address: {}", addr))?; + .context(format!("failed to bind to address: {}", addr))?; - tracing::info!(%addr, "Starting server"); + tracing::info!(%addr, "starting server"); axum::serve(listener, routes::create_router(pool).into_make_service()) .await - .context("Server stopped unexpectedly")?; + .context("server stopped unexpectedly")?; Ok(()) } diff --git a/server/src/repository.rs b/server/src/repository.rs index 48c0ce8..1b6d110 100644 --- a/server/src/repository.rs +++ b/server/src/repository.rs @@ -76,9 +76,9 @@ pub enum ReferenceViolationKind { #[derive(Debug, thiserror::Error)] pub enum QueryConversionError { - #[error("Failed to convert limit: {0}")] + #[error("failed to convert limit: {0}")] Limit(u64), - #[error("Failed to convert offset: {0}")] + #[error("failed to convert offset: {0}")] Offset(u64), }