From 86efcfa5d5385fa4538d57ad84ce2d813c996201 Mon Sep 17 00:00:00 2001 From: Huck Boles Date: Wed, 10 May 2023 18:54:36 -0500 Subject: [PATCH] error messages --- src/filetype/builder.rs | 1 + src/filetype/structs.rs | 2 -- src/parser/parse.rs | 7 +++++-- 3 files changed, 6 insertions(+), 4 deletions(-) delete mode 100644 src/filetype/structs.rs diff --git a/src/filetype/builder.rs b/src/filetype/builder.rs index adea616..982030a 100644 --- a/src/filetype/builder.rs +++ b/src/filetype/builder.rs @@ -131,6 +131,7 @@ fn get_pattern(key: &str, file: &MetaFile, dirs: &Options) -> Result { return Ok(String::new()); }; + // DEFAULT override for variables defined higher in chain if filename == "DEFAULT" { filename = "default"; } diff --git a/src/filetype/structs.rs b/src/filetype/structs.rs deleted file mode 100644 index 139597f..0000000 --- a/src/filetype/structs.rs +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/parser/parse.rs b/src/parser/parse.rs index 7dbb3ae..82c9609 100644 --- a/src/parser/parse.rs +++ b/src/parser/parse.rs @@ -1,5 +1,5 @@ use crate::{source, MetaFile, Source, Substitution}; -use color_eyre::Result; +use color_eyre::{eyre::WrapErr, Result}; use pest::{ iterators::{Pair, Pairs}, Parser, @@ -11,7 +11,10 @@ use std::collections::HashMap; pub struct MetaParser; pub fn parse_file(file: &str) -> Result { - let meta_source = MetaParser::parse(Rule::file, file)?.next().unwrap(); + let meta_source = MetaParser::parse(Rule::file, file) + .wrap_err("parser error")? + .next() + .unwrap(); Ok(parse_pair(meta_source)) } -- 2.45.2