psi_lang/
error.rs

1use smartstring::alias::String;
2quick_error! {
3    #[derive(Debug)]
4    pub enum Error {
5        File(e: std::io::Error) {
6            from()
7            display("Failed to find file")
8        }
9        Syntax(e: pest_consume::Error<crate::Rule>) {
10            from()
11            display("Syntax Error")
12        }
13        NotImplemented(e: String) {
14            display("Not Implemented {:?}", e)
15        }
16        IndexError {
17            display("This index doesn't exist")
18        }
19        VariableNotFound(e: String) {
20            display("Variable {} not found", e)
21        }
22        FunctionNotFound(e: String) {
23            display("Function {} not found", e)
24        }
25        ReturnOutOfFunction {
26            display("Return was used outside of a function")
27        }
28        BreakOutOfLoop {
29            display("Break was used outside of a loop")
30        }
31        ContinueOutOfLoop {
32            display("Continue was used outside of a loop")
33        }
34        InvalidIndex {
35            display("Invalid index type")
36        }
37        EvalNotBool {
38            display("This expression doesn't evaluate to a boolean")
39        }
40        NoReturnValue {
41            display("This function doesn't return anything")
42        }
43        ImpossibleOperation {
44            display("This is an impossible operation")
45        }
46    }
47}