Add error logging for UMP Transforming Errors in the transformed stream

This commit is contained in:
Kavin 2023-12-14 22:48:39 +00:00
parent 437ee17508
commit 7c72df8f0d
No known key found for this signature in database
GPG key ID: 6E4598CA5C92C41F

View file

@ -14,7 +14,7 @@ use std::{env, io};
#[cfg(not(any(feature = "reqwest-native-tls", feature = "reqwest-rustls")))]
compile_error!("feature \"reqwest-native-tls\" or \"reqwest-rustls\" must be set for proxy to have TLS support");
use futures_util::{TryStreamExt};
use futures_util::TryStreamExt;
#[cfg(any(feature = "webp", feature = "avif", feature = "qhash"))]
use tokio::task::spawn_blocking;
use ump_stream::UmpTransformStream;
@ -448,6 +448,11 @@ async fn index(req: HttpRequest) -> Result<HttpResponse, Box<dyn Error>> {
}
let resp = resp.map_err(|e| io::Error::new(ErrorKind::Other, e));
let transformed_stream = UmpTransformStream::new(resp);
// print errors
let transformed_stream = transformed_stream.map_err(|e| {
eprintln!("UMP Transforming Error: {}", e);
e
});
return Ok(response.streaming(transformed_stream));
}