diff --git a/src/main.rs b/src/main.rs index 0fe4af4..e065b38 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,8 +32,8 @@ fn to_blockchain_time(input_datetime: &str) -> Template { dt.and_utc() }, Err(e) => { - println!("error: {}", e); - panic!(); + let err_string = format!{"{}", e}; + return Template::render("error", context!{ error: err_string }); } }; let blocktimes = vec!{ @@ -45,7 +45,6 @@ fn to_blockchain_time(input_datetime: &str) -> Template { let context = context!{ blocktimes }; - println!("{:?}", context); Template::render("blockchain_time_results", context) } diff --git a/templates/error.html.tera b/templates/error.html.tera new file mode 100644 index 0000000..8afb20b --- /dev/null +++ b/templates/error.html.tera @@ -0,0 +1,11 @@ +{% extends "base" %} +{% block content %} +

Error!

+

Error: {{ error }}

+ +

I don't know what you did

+

Maybe that error above will make sense to you, maybe not

+

It's probably because you up a wrong DateTime in

+

Don't forget to put a time in - I don't know how to enforce this with HTML

+

Please try again

+{% endblock content %}