feat(server): refactor handlers, router, state management, and memory tools
This commit is contained in:
1 parent
87ddb01063
commit
a083719cf1
36 files changed
+1899
-597
No files matched your search
+16
-2
@@ -42,8 +42,14 @@ impl IntoResponse for AppError {
|
||||
AppError::Forbidden(msg) => (StatusCode::FORBIDDEN, msg.clone()),
|
||||
AppError::BadRequest(msg) => (StatusCode::BAD_REQUEST, msg.clone()),
|
||||
AppError::Internal(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg.clone()),
|
||||
AppError::JsonError(e) => (StatusCode::INTERNAL_SERVER_ERROR, format!("JSON Error: {}", e)),
|
||||
AppError::IoError(e) => (StatusCode::INTERNAL_SERVER_ERROR, format!("I/O Error: {}", e)),
|
||||
AppError::JsonError(e) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("JSON Error: {}", e),
|
||||
),
|
||||
AppError::IoError(e) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("I/O Error: {}", e),
|
||||
),
|
||||
};
|
||||
|
||||
let body = Json(json!({
|
||||
@@ -115,3 +121,11 @@ impl From<&str> for AppError {
|
||||
AppError::Internal(msg.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
// Generated by improve-test (Attempt 1)
|
||||
#[test]
|
||||
fn test_app_error_unknown_error() {
|
||||
let err = AppError::Internal("unknown error".into());
|
||||
let res = err.into_response();
|
||||
assert_eq!(res.status(), StatusCode::INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
Reference in new issue
Block a user