about summary refs log blame commit diff
path: root/tvix/eval/src/errors.rs
blob: f7f64f4e687a76858c0f4ee86620726c0961b14f (plain) (tree)
1
2
3
4
5
6
7
8


                      
                



                       



                            



                               




                          
 


                                                                        
                                 



                                          
use std::fmt::Display;

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

    InvalidKeyType {
        given: &'static str,
    },

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

    Incomparable {
        lhs: &'static str,
        rhs: &'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>;