Add error logging when rendering the Error page

This commit is contained in:
Matthew Esposito 2024-01-19 19:00:13 -05:00
parent fcde6ff689
commit 3609564db0
No known key found for this signature in database

View File

@ -6,6 +6,7 @@ use crate::{client::json, server::RequestExt};
use askama::Template; use askama::Template;
use cookie::Cookie; use cookie::Cookie;
use hyper::{Body, Request, Response}; use hyper::{Body, Request, Response};
use log::error;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use regex::Regex; use regex::Regex;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
@ -983,6 +984,7 @@ pub fn redirect(path: String) -> Response<Body> {
/// Renders a generic error landing page. /// Renders a generic error landing page.
pub async fn error(req: Request<Body>, msg: impl ToString) -> Result<Response<Body>, String> { pub async fn error(req: Request<Body>, msg: impl ToString) -> Result<Response<Body>, String> {
error!("Error page rendered: {}", msg.to_string());
let url = req.uri().to_string(); let url = req.uri().to_string();
let body = ErrorTemplate { let body = ErrorTemplate {
msg: msg.to_string(), msg: msg.to_string(),