flac/oss-fuzz/fuzzing/exception.hpp
Erik de Castro Lopo b19f3a6114 oss-fuzz: Add fuzzing headers
These includes header files were taken from:

    https://github.com/guidovranken/fuzzing-headers.git

with some minor changes required to make them compile cleanly
with the extra compiler warning flags used by the FLAC build
system.
2019-11-18 06:29:10 +11:00

45 lines
1.0 KiB
C++

#pragma once
#include <exception>
#include <string>
namespace fuzzing {
namespace exception {
class ExceptionBase : public std::exception {
public:
ExceptionBase(void) = default;
/* typeid(T).name */
};
/* Recoverable exception */
class FlowException : public ExceptionBase {
public:
FlowException(void) : ExceptionBase() { }
};
/* Error in this library, should never happen */
class LogicException : public ExceptionBase {
private:
std::string reason;
public:
LogicException(const std::string r) : ExceptionBase(), reason(r) { }
virtual const char* what(void) const throw() {
return reason.c_str();
}
};
/* Error in target application */
class TargetException : public ExceptionBase {
private:
std::string reason;
public:
TargetException(const std::string r) : ExceptionBase(), reason(r) { }
virtual const char* what(void) const throw() {
return reason.c_str();
}
};
} /* namespace exception */
} /* namespace fuzzing */