remove todos

This commit is contained in:
Edward Shen 2021-04-18 17:11:30 -04:00
parent 6717fbe20b
commit de17c738d2
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 9 additions and 2 deletions

4
src/cache/fs.rs vendored
View file

@ -1,3 +1,4 @@
use actix_web::HttpResponse;
use bytes::BytesMut; use bytes::BytesMut;
use futures::{Future, Stream, StreamExt}; use futures::{Future, Stream, StreamExt};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
@ -158,8 +159,9 @@ impl Stream for FsStream {
} }
impl From<UpstreamError> for actix_web::Error { impl From<UpstreamError> for actix_web::Error {
#[inline]
fn from(_: UpstreamError) -> Self { fn from(_: UpstreamError) -> Self {
todo!() HttpResponse::BadGateway().finish().into()
} }
} }

View file

@ -245,7 +245,12 @@ async fn fetch_image(
let (stream, metadata) = { let (stream, metadata) = {
match cache.lock().put(key, Box::new(body), metadata).await { match cache.lock().put(key, Box::new(body), metadata).await {
Ok((stream, metadata)) => (stream, *metadata), Ok((stream, metadata)) => (stream, *metadata),
Err(_) => todo!(), Err(e) => {
warn!("Failed to insert into cache: {}", e);
return ServerResponse::HttpResponse(
HttpResponse::InternalServerError().finish(),
);
}
} }
}; };