diff --git a/Cargo.toml b/Cargo.toml index 34b6347..92ab545 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oink" -version = "0.0.1" +version = "0.0.2" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..8fdd405 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,4 @@ + +[toolchain] +channel = "nightly" + diff --git a/src/main.rs b/src/main.rs index 159dc6a..f21206b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +#![feature(error_in_core)] use std::process::exit; use pico_args::Arguments; diff --git a/src/operation.rs b/src/operation.rs index 49dfc13..4db59bd 100644 --- a/src/operation.rs +++ b/src/operation.rs @@ -5,6 +5,7 @@ use std::{ io::Write, path::Path }; +use core::error::Error; use toml::{ map::Map, Value }; use tera::{ Context, Tera }; @@ -66,7 +67,10 @@ pub fn build(targets: &Vec>, tera: &mut Tera, context: &Conte let render = tera.render(name, context); // handle rendering errors gracefully if render.is_err() { - println!(" failed to render template"); + let error = render.err().unwrap(); + let message = error.source().unwrap(); + + println!(" failed to render template:\n {message}"); continue; }