about summary refs log tree commit diff
path: root/tvix/eval/src/errors.rs
blob: fb9f3b6ec589a92ce3d4c446866ce1af20949d2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::fmt::Display;

#[derive(Debug)]
pub enum Error {
    DuplicateAttrsKey {
        key: String,
    },

    InvalidKeyType {
        given: &'static str,
    },

    TypeError {
        expected: &'static str,
        actual: &'static str,
    },
}

impl Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        writeln!(f, "{:?}", self)
    }
}

pub type EvalResult<T> = Result<T, Error>;