[AI] fix some modules, develop the big part of modules. TODO fix critical errors, update pipeline, test everything

This commit is contained in:
2026-05-16 19:16:50 +07:00
parent 0824033602
commit 1ef93c2025
42 changed files with 2780 additions and 786 deletions
+8 -7
View File
@@ -24,8 +24,8 @@ pub enum AppError {
NotFound(String),
#[error("Business Logic: {0}")]
BusinessLogic(String),
#[error("Internal Server Error")]
Internal,
#[error("Internal Server Error: {0}")]
Internal(String),
}
impl IntoResponse for AppError {
@@ -39,7 +39,8 @@ impl IntoResponse for AppError {
AppError::Unauthorized(_) => "unauthorized",
AppError::NotFound(_) => "not_found",
AppError::BusinessLogic(_) => "business_logic",
AppError::Internal => "internal",
// FIX: Add `(_)` to ignore the inner string when just grabbing the type
AppError::Internal(_) => "internal",
};
// Метрики остаются как были
@@ -55,7 +56,6 @@ impl IntoResponse for AppError {
(StatusCode::CONFLICT, "Trial already used".to_string())
}
AppError::Database(e) => {
// Логируем саму ошибку базы как отдельное поле для поиска
error!(error_type, db_error = ?e, "Database execution failure");
(
StatusCode::INTERNAL_SERVER_ERROR,
@@ -88,11 +88,12 @@ impl IntoResponse for AppError {
warn!(error_type, details = %msg, "Business logic violation");
(StatusCode::BAD_REQUEST, msg.clone())
}
AppError::Internal => {
error!(error_type, "Critical internal failure");
// FIX: Bind the inner string to `msg` and log it!
AppError::Internal(msg) => {
error!(error_type, details = %msg, "Critical internal failure");
(
StatusCode::INTERNAL_SERVER_ERROR,
"Critical failure".to_string(),
"Critical failure".to_string(), // We keep the user-facing message safe/generic
)
}
};