Refactor template handler module for tighter interfaces
This commit is contained in:
parent
37a1259c0d
commit
b443116e56
2 changed files with 138 additions and 36 deletions
|
|
@ -47,15 +47,17 @@ fn make_body(
|
|||
context.insert("message", out_message);
|
||||
context.insert("status_code", &out_code.to_string());
|
||||
|
||||
handlers::template::render(
|
||||
match handlers::template::render(
|
||||
"error",
|
||||
&context,
|
||||
Some(&format!(
|
||||
"Failed to render template for Error {out_code}: {out_message}"
|
||||
))
|
||||
.cloned(),
|
||||
)
|
||||
.0
|
||||
) {
|
||||
Ok(rendered) => rendered.html,
|
||||
Err(error) => error.template.html,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn not_found(State(state): State<GlobalState>) -> Response<Body> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue