aboutsummaryrefslogtreecommitdiff
path: root/include/error.h
blob: ec0bffe19d4d01dc4dabbdef40505e0767b5eb07 (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
33
34
35
36
37
38
39
40
41

#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,

    // file
    FILE_MODE_NOT_SET,
    FILE_FAIL_TO_OPEN,
    FILE_OFLAG_ERROR,
    FILE_POINTER_FAIL_TO_OPEN,

    // pipe
    FAIL_TO_OPEN_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) {}
};
    
}