diff options
author | Vincent Ambo <mail@tazj.in> | 2018-05-22T16·35+0200 |
---|---|---|
committer | Vincent Ambo <github@tazj.in> | 2018-05-22T18·44+0200 |
commit | f5badb97d333ffbc2d294cbff3afda0bd4879b56 (patch) | |
tree | 8bb9d91964f45f6d8ce944b946746512f2adab91 /src/errors.rs | |
parent | d90dc2d77fd813257e24a45456cb6b10791999e6 (diff) |
refactor(templates): Use Askama for index template
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/errors.rs b/src/errors.rs index c4c2be198e85..05642d0a8598 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -28,6 +28,7 @@ use actix_web::http::StatusCode; // Modules with foreign errors: use actix; use actix_web; +use askama; use diesel; use r2d2; use reqwest; @@ -50,6 +51,9 @@ pub enum ConverseError { #[fail(display = "a template rendering error occured: {}", reason)] Template { reason: String }, + #[fail(display = "a template rendering error occured: {}", reason)] + Askama { reason: String }, + #[fail(display = "error occured during request handling: {}", error)] ActixWeb { error: actix_web::Error }, @@ -88,6 +92,14 @@ impl From<tera::Error> for ConverseError { } } +impl From<askama::Error> for ConverseError { + fn from(error: askama::Error) -> ConverseError { + ConverseError::Askama { + reason: format!("{}", error), + } + } +} + impl From<actix::MailboxError> for ConverseError { fn from(error: actix::MailboxError) -> ConverseError { ConverseError::Actix { error: Box::new(error) } |