aboutsummaryrefslogtreecommitdiff
path: root/include/error.h
blob: d058ec4f338abca4953b68f60d2e31e4c7ef32ef (plain)
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
26
27
28
29
30
31
32

#pragma once

#include <stdexcept>

namespace ov4
{

enum class error_code
{

    // tokenizer
    TOKEN_UNMATCHED_BRACKET,

    // AST
    AST_MISS_LEFT_CHILD,
    AST_MISS_RIGHT_CHILD,
    AST_EXIST_LEFT_CHILLD,
    AST_EXIST_RIGHT_CHILD,

    // eval
    EVAL_FAIL_TO_CREATE_PIPE,

};

class T_error : public std::runtime_error {
public:
    error_code code;
    T_error(error_code k, std::string msg)
        : std::runtime_error(std::move(msg)), code(k) {}
};
    
}