Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2024 | ||
3 | ** Zappy GUI | ||
4 | ** File description: | ||
5 | ** Exceptions | ||
6 | */ | ||
7 | |||
8 | #ifndef EXCEPTIONS_HPP | ||
9 | #define EXCEPTIONS_HPP | ||
10 | |||
11 | #include <exception> | ||
12 | #include <string> | ||
13 | |||
14 | namespace utils | ||
15 | { | ||
16 | class Exception : public std::exception { | ||
17 | public: | ||
18 | 30 | Exception(const std::string &name, const std::string &message) : _message(name + ": " + message) {} | |
19 | ✗ | [[nodiscard]] const char *what() const noexcept override { return _message.c_str(); } | |
20 | |||
21 | private: | ||
22 | std::string _message; | ||
23 | }; | ||
24 | } // namespace utils | ||
25 | |||
26 | #endif // EXCEPTIONS_HPP | ||
27 |