From 5c556a08038af911df859fc4f8043a425a62a51e Mon Sep 17 00:00:00 2001 From: Snorre Date: Tue, 25 Mar 2025 11:46:48 +0100 Subject: [PATCH] more error logging --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 44c974c..c80f899 100644 --- a/src/main.rs +++ b/src/main.rs @@ -208,10 +208,10 @@ fn handle_connection(mut stream: TcpStream) { .reduce(|a, b| format!("{}\n{}", b, a)) .unwrap() } - // .reduce(|i, x| format!("{}\n{}", i, x)) - // .unwrap() - // .to_string(), - Err(e) => format!("HTTP/1.1 500\r\n\r\n{}", e), + Err(e) => { + eprintln!("\x1b[0;31mError when fetching list of posts: {e:?}\x1b[0m"); + format!("HTTP/1.1 500\r\n\r\n{}", e) + }, } } .as_bytes(),