Refactor error messages to not have quotes
This commit is contained in:
parent
f817598a9d
commit
627e326ac5
@ -23,7 +23,7 @@ impl SassError {
|
|||||||
|
|
||||||
impl Display for SassError {
|
impl Display for SassError {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(f, "error: {} at {}", self.message, self.pos)
|
write!(f, "Error: {}", self.message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
src/main.rs
11
src/main.rs
@ -3,7 +3,7 @@ use std::io::{stdout, BufWriter};
|
|||||||
|
|
||||||
use grass::StyleSheet;
|
use grass::StyleSheet;
|
||||||
|
|
||||||
fn main() -> Result<(), String> {
|
fn main() {
|
||||||
let matches = App::new("grass")
|
let matches = App::new("grass")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.about("SCSS Compiler in rust")
|
.about("SCSS Compiler in rust")
|
||||||
@ -63,8 +63,13 @@ fn main() -> Result<(), String> {
|
|||||||
let mut stdout = BufWriter::new(stdout());
|
let mut stdout = BufWriter::new(stdout());
|
||||||
if let Some(inputs) = matches.values_of("INPUT") {
|
if let Some(inputs) = matches.values_of("INPUT") {
|
||||||
for name in inputs {
|
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(())
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user