hydrobricks
Loading...
Searching...
No Matches
Exceptions.h
Go to the documentation of this file.
1#ifndef EXCEPTIONS_H
2#define EXCEPTIONS_H
3
4#include <stdexcept>
5#include <string>
6
27// ============================================================================
28// Root Exception
29// ============================================================================
30
38class HydrobricksError : public std::runtime_error {
39 public:
40 explicit HydrobricksError(const char* msg)
41 : std::runtime_error(msg) {}
42
43 explicit HydrobricksError(const std::string& msg)
44 : std::runtime_error(msg) {}
45
46 virtual ~HydrobricksError() = default;
47};
48
49// ============================================================================
50// Input Validation Errors (std::invalid_argument base) - User's fault
51// ============================================================================
52
64 public:
65 explicit InputError(const char* msg)
66 : HydrobricksError(msg) {}
67
68 explicit InputError(const std::string& msg)
69 : HydrobricksError(msg) {}
70
71 virtual ~InputError() = default;
72};
73
89 public:
90 explicit ModelConfigError(const char* msg)
91 : HydrobricksError(msg) {}
92
93 explicit ModelConfigError(const std::string& msg)
94 : HydrobricksError(msg) {}
95
96 virtual ~ModelConfigError() = default;
97};
98
99// ============================================================================
100// Internal Logic Errors (std::logic_error base) - Programmer's fault
101// ============================================================================
102
112 public:
114 : HydrobricksError("Function not yet implemented") {}
115
116 explicit NotImplemented(const char* msg)
117 : HydrobricksError(msg) {}
118
119 explicit NotImplemented(const std::string& msg)
120 : HydrobricksError(msg) {}
121
122 virtual ~NotImplemented() = default;
123};
124
134 public:
136 : HydrobricksError("This should not happen...") {}
137
138 explicit ShouldNotHappen(const char* msg)
139 : HydrobricksError(msg) {}
140
141 explicit ShouldNotHappen(const std::string& msg)
142 : HydrobricksError(msg) {}
143
144 virtual ~ShouldNotHappen() = default;
145};
146
147// ============================================================================
148// Runtime Errors (std::runtime_error base)
149// ============================================================================
150
159 public:
160 explicit RuntimeError(const char* msg)
161 : HydrobricksError(msg) {}
162
163 explicit RuntimeError(const std::string& msg)
164 : HydrobricksError(msg) {}
165
166 virtual ~RuntimeError() = default;
167};
168
169#endif // EXCEPTIONS_H
Root exception class for all Hydrobricks-specific errors.
Definition Exceptions.h:38
Exception for invalid user input.
Definition Exceptions.h:63
Exception for model configuration or conception errors.
Definition Exceptions.h:88
Exception for unimplemented features.
Definition Exceptions.h:111
Exception for unexpected runtime conditions.
Definition Exceptions.h:158
Exception for code paths that should never be reached.
Definition Exceptions.h:133