Webserv
Loading...
Searching...
No Matches
ConfigException.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <exception>
4#include <string>
5
6namespace config {
7
8#define YELLOW "\033[1;33m"
9#define RED "\033[1;31m"
10#define NC "\033[0m"
11
12class ConfigException : public std::exception {
13private:
14 std::string message_;
15
16public:
17 ConfigException(std::string const &message) : message_(message) {
18 }
19 virtual ~ConfigException() throw() {
20 }
21 char const *what(void) const throw() {
22 return message_.c_str();
23 }
24};
25
27public:
28 ConfigError(std::string const &message) : ConfigException(RED "Error: " NC + message) {
29 }
30};
31
33public:
34 ConfigWarning(std::string const &message) : ConfigException(YELLOW "Warning: " NC + message) {
35 }
36};
37
38void issue_warning(const std::string &msg);
39
40} // namespace config
#define NC
Definition ConfigException.hpp:10
#define RED
Definition ConfigException.hpp:9
#define YELLOW
Definition ConfigException.hpp:8
ConfigError(std::string const &message)
Definition ConfigException.hpp:28
std::string message_
Definition ConfigException.hpp:14
char const * what(void) const
Definition ConfigException.hpp:21
virtual ~ConfigException()
Definition ConfigException.hpp:19
ConfigException(std::string const &message)
Definition ConfigException.hpp:17
ConfigWarning(std::string const &message)
Definition ConfigException.hpp:34
Definition ConfigException.hpp:6
void issue_warning(const std::string &msg)
Definition ConfigException.cpp:8