master
Avril 4 years ago
parent 1dc731f77f
commit e161688fc0
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -12,7 +12,9 @@ pub enum Error {
NotFound(PathBuf),
InvalidUtf8,
TypeError{expected:LispType, got: LispType},
BadLength,
UnexpectedEmpty,
UnknownDefinition(String),
Unknown,
}
@ -52,7 +54,9 @@ impl std::fmt::Display for Error
Self::NotFound(path) => write!(f, "File not found: {:?}", path),
Self::InvalidUtf8 => write!(f, "Invalid UTF8 decoded string or some such"),
Self::TypeError{expected, got} => write!(f, "Type mismatch: Expected {}, got {}", expected, got),
Self::BadLength => write!(f, "expected at least 1 element"),
Self::UnexpectedEmpty => write!(f, "expected a non-empty list"),
Self::UnknownDefinition(def) => write!(f, "unknown definition `{}'", def),
_ => write!(f, "unknown error")
}
}

@ -105,7 +105,7 @@ impl LispExt for Vec<Sexp>
} else if self.len() > 0{
Ok((&self[0], &[]))
} else {
Err(Error::BadLength)
Err(Error::UnexpectedEmpty)
}
}
}

@ -80,7 +80,7 @@ pub async fn global(to: &mut Config, path: impl AsRef<Path>) -> Result<(), error
"debug" => set_debug(to ,cdr),
"allow" => mwee(to, cdr),
"deny" => mwee(to, cdr),
_ => return Err(Error::Unknown),
_ => return Err(Error::UnknownDefinition(car.to_owned())),
}?;
}
Ok(())

Loading…
Cancel
Save