fix: remove unused imports and add comment for error handling

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-25 18:19:45 -03:00
parent ff91e7051f
commit c49a63bb10

View File

@@ -4,10 +4,8 @@ use axum::{
response::{Json, Response}, response::{Json, Response},
http::header, http::header,
}; };
use tokio::io::{AsyncReadExt, AsyncSeekExt};
use log::warn; use log::warn;
use std::collections::HashMap; use std::collections::HashMap;
use anyhow;
use crate::services::async_item_service::AsyncItemService; use crate::services::async_item_service::AsyncItemService;
use crate::services::error::CoreError; use crate::services::error::CoreError;
@@ -252,6 +250,7 @@ pub async fn handle_get_item_content(
Ok(response) Ok(response)
} }
Err(e) => { Err(e) => {
// Check if the error is ItemNotFound to return 404
if let Some(core_err) = e.downcast_ref::<CoreError>() { if let Some(core_err) = e.downcast_ref::<CoreError>() {
if matches!(core_err, CoreError::ItemNotFound(_)) { if matches!(core_err, CoreError::ItemNotFound(_)) {
return Err(StatusCode::NOT_FOUND); return Err(StatusCode::NOT_FOUND);