Show actual Tera source error
This commit is contained in:
parent
260c413de4
commit
776bf41123
|
@ -29,7 +29,17 @@ unsafe impl Send for Error {}
|
||||||
|
|
||||||
impl StdError for Error {
|
impl StdError for Error {
|
||||||
fn source(&self) -> Option<&(dyn StdError + 'static)> {
|
fn source(&self) -> Option<&(dyn StdError + 'static)> {
|
||||||
self.source.as_ref().map(|c| &**c)
|
let mut source = self.source.as_ref().map(|c| &**c);
|
||||||
|
if source.is_none() {
|
||||||
|
match self.kind {
|
||||||
|
ErrorKind::Tera(ref err) => {
|
||||||
|
source = err.source()
|
||||||
|
},
|
||||||
|
_ => ()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
source
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ use chrono::Duration;
|
||||||
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
|
||||||
|
|
||||||
use site::Site;
|
use site::Site;
|
||||||
|
use errors::Error;
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// Termcolor color choice.
|
/// Termcolor color choice.
|
||||||
|
@ -92,7 +93,7 @@ pub fn report_elapsed_time(instant: Instant) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Display an error message and the actual error(s)
|
/// Display an error message and the actual error(s)
|
||||||
pub fn unravel_errors(message: &str, error: &StdError) {
|
pub fn unravel_errors(message: &str, error: &Error) {
|
||||||
if !message.is_empty() {
|
if !message.is_empty() {
|
||||||
self::error(message);
|
self::error(message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue