Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion servers/rust-server/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl IntoResponse for AppError {
#[template(path = "error.html")]
struct Tmpl {
error: String,
status: StatusCode,
}

let status = match &self {
Expand All @@ -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 {
Expand Down
9 changes: 8 additions & 1 deletion servers/rust-server/templates/error.html
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
<h1>Sorry, we encountered an error: {{ error }}</h1>
{% extends "base.html" %} {% block title %}{{ status }} - {{ error }}{% endblock
%} {% block content %}
<div>
<h1>Oops! Something went wrong</h1>
<h4>{{ status }} - {{ error }}</h4>
<a href="/home">← home</a>
</div>
{% endblock %}