-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathException.hpp
104 lines (83 loc) · 2.5 KB
/
Exception.hpp
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef ABSTRACTVM_EXCEPTION_HPP
#define ABSTRACTVM_EXCEPTION_HPP
#include <exception>
#include <stdexcept>
#include <iostream>
#include <type_traits>
class Exception
{
public:
class InputException : public std::exception
{
std::invalid_argument _error;
public:
explicit InputException(const char *msg);
const char *what() const noexcept override;
~InputException() override;
};
class OverflowException : public std::exception
{
std::overflow_error _error;
public:
explicit OverflowException(const char *msg);
const char *what() const noexcept override;
~OverflowException() override;
};
class UnderflowException : public std::exception
{
std::underflow_error _error;
public:
explicit UnderflowException(const char *msg);
const char *what() const noexcept override;
~UnderflowException() override;
};
class EmptyStackException : public std::exception
{
std::runtime_error _error;
public:
explicit EmptyStackException(const char *msg);
const char *what() const noexcept override;
~EmptyStackException() override;
};
class DivisionByZeroException : public std::exception
{
std::runtime_error _error;
public:
explicit DivisionByZeroException(const char *msg);
const char *what() const noexcept override;
~DivisionByZeroException() override;
};
class SmallStackException : public std::exception
{
std::runtime_error _error;
public:
explicit SmallStackException(const char *msg);
const char *what() const noexcept override;
~SmallStackException() override;
};
class AssertionException : public std::exception
{
std::runtime_error _error;
public:
explicit AssertionException(const char *msg);
const char *what() const noexcept override;
~AssertionException() override;
};
class WrongExitException : public std::exception
{
std::logic_error _error;
public:
explicit WrongExitException(const char *msg);
const char *what() const noexcept override;
~WrongExitException() override;
};
class NoExitException : public std::exception
{
std::logic_error _error;
public:
explicit NoExitException(const char *msg);
const char *what() const noexcept override;
~NoExitException() override;
};
};
#endif