use layout for internal errors

This commit is contained in:
Vincent Breitmoser 2019-05-05 23:31:40 +02:00
parent ee92301fb9
commit 70cb8319d6
3 changed files with 9 additions and 5 deletions

View File

@ -1 +1,7 @@
500 :(
{{#> layout }}
<h2>Error</h2>
<p>Looks like something went wrong :(</p>
<p><strong>Error:</strong> {{internal_error}}</p>
{{/layout}}

View File

@ -1,2 +0,0 @@
{{#> layout }}
{{/layout}}

View File

@ -93,7 +93,7 @@ impl MyResponse {
pub fn ise(e: failure::Error) -> Self {
println!("Internal error: {:?}", e);
let ctx = templates::FiveHundred{
error: format!("{}", e),
internal_error: e.to_string(),
version: env!("VERGEN_SEMVER").to_string(),
commit: env!("VERGEN_SHA_SHORT").to_string(),
};
@ -135,7 +135,7 @@ mod templates {
#[derive(Serialize)]
pub struct FiveHundred {
pub error: String,
pub internal_error: String,
pub commit: String,
pub version: String,
}