diff --git a/servers/rust-server/src/error.rs b/servers/rust-server/src/error.rs index 793e2d3..5dc025c 100644 --- a/servers/rust-server/src/error.rs +++ b/servers/rust-server/src/error.rs @@ -55,6 +55,7 @@ impl IntoResponse for AppError { #[template(path = "error.html")] struct Tmpl { error: String, + status: StatusCode, } let status = match &self { @@ -73,7 +74,7 @@ impl IntoResponse for AppError { }, AppError::DatabaseError(_) => StatusCode::INTERNAL_SERVER_ERROR, }; - let tmpl = Tmpl { error: self.to_string() }; + let tmpl = Tmpl { error: self.to_string(), status }; if let Ok(body) = tmpl.render() { (status, Html(body)).into_response() } else { diff --git a/servers/rust-server/templates/error.html b/servers/rust-server/templates/error.html index 31e0330..46e4dd7 100644 --- a/servers/rust-server/templates/error.html +++ b/servers/rust-server/templates/error.html @@ -1 +1,8 @@ -

Sorry, we encountered an error: {{ error }}

\ No newline at end of file +{% extends "base.html" %} {% block title %}{{ status }} - {{ error }}{% endblock +%} {% block content %} +
+

Oops! Something went wrong

+

{{ status }} - {{ error }}

+ ← home +
+{% endblock %}