Merge branch 'main' into colorize

This commit is contained in:
Valerie Wolfe 2023-08-17 14:09:06 -04:00
commit fdb052cfe1
4 changed files with 11 additions and 2 deletions

View file

@ -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

4
rust-toolchain.toml Normal file
View file

@ -0,0 +1,4 @@
[toolchain]
channel = "nightly"

View file

@ -1,3 +1,4 @@
#![feature(error_in_core)]
use std::process::exit;
use pico_args::Arguments;

View file

@ -5,6 +5,7 @@ use std::{
io::Write,
path::Path
};
use core::error::Error;
use tera::{ Context, Tera };
use termion::{
@ -70,7 +71,10 @@ pub fn build(targets: &Vec<Map<String, Value>>, 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;
}