-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.h
52 lines (43 loc) · 1.24 KB
/
exceptions.h
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
42
43
44
45
46
47
48
49
50
51
52
/**
* @file include/retdec/llvmir-emul/exceptions.h
* @brief Definitions of exceptions used in llvmir-emul library.
* @copyright (c) 2017 Avast Software, licensed under the MIT license
*/
#ifndef RETDEC_LLVMIR_EMUL_EXCEPTIONS_H
#define RETDEC_LLVMIR_EMUL_EXCEPTIONS_H
#include <cassert>
#include <sstream>
#include <stdexcept>
namespace retdec {
namespace llvmir_emul {
/**
* Base class for all LlvmIrEmulator errors.
*/
class LlvmIrEmulatorBaseError : public std::exception
{
public:
virtual ~LlvmIrEmulatorBaseError() = default;
};
/**
* A general exception class for all LlvmIrEmulator errors.
*/
class LlvmIrEmulatorError : public LlvmIrEmulatorBaseError
{
public:
LlvmIrEmulatorError(const std::string& message) :
_whatMessage(message)
{
std::cout << message << std::endl;
assert(false);
}
virtual const char* what() const noexcept override
{
return _whatMessage.c_str();
}
private:
/// Message returned by @c what() method.
std::string _whatMessage;
};
} // llvmir_emul
} // retdec
#endif