Prepare eval error handling for cli arg errors

This commit is contained in:
Joscha 2021-12-18 23:31:27 +01:00
parent 279bf4a4d1
commit ff627b98df
8 changed files with 107 additions and 93 deletions

View file

@ -1,7 +1,6 @@
use std::result;
use crate::eval;
use crate::files::Files;
use crate::eval::{self, SourceInfo};
#[derive(Debug, thiserror::Error)]
pub enum Error {
@ -14,9 +13,9 @@ pub enum Error {
}
impl Error {
pub fn print(&self, files: &Files) {
pub fn print<'a>(&self, sources: &[SourceInfo<'a>]) {
match self {
Error::Eval(e) => e.print(files),
Error::Eval(e) => e.print(sources),
Error::NoSuchEntry(n) => eprintln!("No entry with number {}", n),
Error::NotATask(ns) => {
if ns.is_empty() {