From 0ed62870245f5687db62c5b1d5b718865298d704 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Fri, 2 Jul 2021 15:58:25 +0200 Subject: [PATCH] refactor: auto compression error result log --- src/handler.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/handler.rs b/src/handler.rs index 7909b3c..f3b06d3 100644 --- a/src/handler.rs +++ b/src/handler.rs @@ -52,7 +52,16 @@ impl RequestHandler { Ok(mut resp) => { // Auto compression based on the `Accept-Encoding` header if self.opts.compression { - resp = compression::auto(method, headers, resp)?; + resp = match compression::auto(method, headers, resp) { + Ok(res) => res, + Err(err) => { + tracing::debug!("error during body compression: {:?}", err); + return error_page::error_response( + method, + &StatusCode::INTERNAL_SERVER_ERROR, + ); + } + }; } // Append `Cache-Control` headers for web assets -- libgit2 1.7.2