Caught error where you don't put Date or Time in

This commit is contained in:
2024-07-15 21:22:41 +01:00
parent 3091cd80fd
commit d544e598e4
2 changed files with 13 additions and 3 deletions

View File

@@ -32,8 +32,8 @@ fn to_blockchain_time(input_datetime: &str) -> Template {
dt.and_utc() dt.and_utc()
}, },
Err(e) => { Err(e) => {
println!("error: {}", e); let err_string = format!{"{}", e};
panic!(); return Template::render("error", context!{ error: err_string });
} }
}; };
let blocktimes = vec!{ let blocktimes = vec!{
@@ -45,7 +45,6 @@ fn to_blockchain_time(input_datetime: &str) -> Template {
let context = context!{ let context = context!{
blocktimes blocktimes
}; };
println!("{:?}", context);
Template::render("blockchain_time_results", context) Template::render("blockchain_time_results", context)
} }

11
templates/error.html.tera Normal file
View File

@@ -0,0 +1,11 @@
{% extends "base" %}
{% block content %}
<h1>Error!</h1>
<p>Error: <span class="result">{{ error }}</span></p>
<p>I don't know what you did</p>
<p>Maybe that error above will make sense to you, maybe not</p>
<p>It's probably because you up a wrong DateTime in</p>
<p>Don't forget to put a time in - I don't know how to enforce this with HTML</p>
<p><a href="/">Please try again</a></p>
{% endblock content %}