Coverage Report

Created: 2024-06-28 06:39

/src/cryptofuzz/fuzzing-headers/include/fuzzing/exception.hpp
Line
Count
Source (jump to first uncovered line)
1
#ifndef FUZZING_EXCEPTION_HPP
2
#define FUZZING_EXCEPTION_HPP
3
4
#include <exception>
5
#include <string>
6
7
namespace fuzzing {
8
namespace exception {
9
10
class ExceptionBase : public std::exception {
11
    public:
12
116k
        ExceptionBase(void) = default;
13
        /* typeid(T).name */
14
};
15
16
/* Recoverable exception */
17
class FlowException : public ExceptionBase {
18
    public:
19
116k
        FlowException(void) : ExceptionBase() { }
20
};
21
22
/* Error in this library, should never happen */
23
class LogicException : public ExceptionBase {
24
    private:
25
        std::string reason;
26
    public:
27
0
        LogicException(const std::string reason) : ExceptionBase(), reason(reason) { }
28
0
        virtual const char* what(void) const throw() {
29
0
            return reason.c_str();
30
0
        }
31
};
32
33
/* Error in target application */
34
class TargetException : public ExceptionBase {
35
    private:
36
        std::string reason;
37
    public:
38
0
        TargetException(const std::string reason) : ExceptionBase(), reason(reason) { }
39
0
        virtual const char* what(void) const throw() {
40
0
            return reason.c_str();
41
0
        }
42
};
43
44
} /* namespace exception */
45
} /* namespace fuzzing */
46
47
#endif