From 627e326ac5a59a4b922d1e2e3919da4b7d1e21d5 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 16 Feb 2020 11:10:03 -0500 Subject: [PATCH] Refactor error messages to not have quotes --- src/error.rs | 2 +- src/main.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/error.rs b/src/error.rs index caeba44..a62a894 100644 --- a/src/error.rs +++ b/src/error.rs @@ -23,7 +23,7 @@ impl SassError { impl Display for SassError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "error: {} at {}", self.message, self.pos) + write!(f, "Error: {}", self.message) } } diff --git a/src/main.rs b/src/main.rs index da91851..ef6cf36 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ use std::io::{stdout, BufWriter}; use grass::StyleSheet; -fn main() -> Result<(), String> { +fn main() { let matches = App::new("grass") .version(env!("CARGO_PKG_VERSION")) .about("SCSS Compiler in rust") @@ -63,8 +63,13 @@ fn main() -> Result<(), String> { let mut stdout = BufWriter::new(stdout()); if let Some(inputs) = matches.values_of("INPUT") { for name in inputs { - StyleSheet::from_path(name)?.print_as_css(&mut stdout)?; + match StyleSheet::from_path(name) { + Ok(a) => a, + Err(b) => { + eprintln!("{}", b); + std::process::exit(1) + } + }.print_as_css(&mut stdout).unwrap(); } } - Ok(()) }