From 8cc0cfc6062186661056bf15b2f04171d88b3f26 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Mon, 25 Aug 2025 18:21:56 -0300 Subject: [PATCH] fix: replace matches with pattern matching for CoreError handling Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) --- src/modes/server/api/item.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modes/server/api/item.rs b/src/modes/server/api/item.rs index ea0e0c5..958cb83 100644 --- a/src/modes/server/api/item.rs +++ b/src/modes/server/api/item.rs @@ -197,8 +197,9 @@ pub async fn handle_get_item_latest_content( Err(e) => { // Check if the error is ItemNotFoundGeneric to return 404 if let Some(core_err) = e.downcast_ref::() { - if matches!(core_err, CoreError::ItemNotFoundGeneric) { - return Err(StatusCode::NOT_FOUND); + match core_err { + CoreError::ItemNotFoundGeneric => return Err(StatusCode::NOT_FOUND), + _ => {} } } warn!("Failed to find latest item for content: {}", e); @@ -258,8 +259,9 @@ pub async fn handle_get_item_content( Err(e) => { // Check if the error is ItemNotFound to return 404 if let Some(core_err) = e.downcast_ref::() { - if matches!(core_err, CoreError::ItemNotFound(_)) { - return Err(StatusCode::NOT_FOUND); + match core_err { + CoreError::ItemNotFound(_) => return Err(StatusCode::NOT_FOUND), + _ => {} } } warn!("Failed to get raw content for item {}: {}", item_id, e);