All errors were API mismatches — handler code calling wrong method names, wrong argument types, or missing imports/derives. No logic changes. Build now passes with SQLX_OFFLINE=true. Key fixes: - embed_text -> embed_one, Vector -> Vec<f32> conversion - extract_token: extract auth header from HttpRequest first - AuthError variants aligned to actual enum definition - recursive async fns boxed (dfs_paths in inference + path_finder) - missing derives (Default, Serialize), imports (sqlx::Row, Timelike) - borrow-after-move: compute .len() before struct field move - streaming_body -> streaming with Result<Bytes> for SSE - CI: add SQLX_OFFLINE=true for offline builds without DB 25 files changed, 99 insertions(+), 81 deletions(-) Co-authored-by: rock <[email protected]>
This commit was merged in pull request #26.
This commit is contained in:
@@ -59,15 +59,17 @@ pub fn auth_error_response(error: &AuthError) -> HttpResponse {
|
||||
let (status, message) = match error {
|
||||
AuthError::MissingToken => ("Unauthorized", "Missing or invalid Authorization header"),
|
||||
AuthError::InvalidSignature => ("Unauthorized", "Invalid token signature"),
|
||||
AuthError::ExpiredToken => ("Unauthorized", "Token has expired"),
|
||||
AuthError::TokenExpired => ("Unauthorized", "Token has expired"),
|
||||
AuthError::InvalidIssuer => ("Unauthorized", "Invalid token issuer"),
|
||||
AuthError::AccessDenied => ("Forbidden", "Access denied for this resource"),
|
||||
AuthError::InvalidClaims => ("Unauthorized", "Invalid or missing required claims"),
|
||||
AuthError::InvalidAudience => ("Unauthorized", "Invalid token audience"),
|
||||
AuthError::ProviderUnavailable(_) => ("ServiceUnavailable", "Auth provider unavailable"),
|
||||
AuthError::Other(_) => ("Unauthorized", "Authentication error"),
|
||||
};
|
||||
|
||||
HttpResponse::build(match status {
|
||||
"Unauthorized" => actix_web::http::StatusCode::UNAUTHORIZED,
|
||||
"Forbidden" => actix_web::http::StatusCode::FORBIDDEN,
|
||||
"ServiceUnavailable" => actix_web::http::StatusCode::SERVICE_UNAVAILABLE,
|
||||
_ => actix_web::http::StatusCode::INTERNAL_SERVER_ERROR,
|
||||
})
|
||||
.json(json!({
|
||||
|
||||
Reference in New Issue
Block a user