-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.hpp
53 lines (40 loc) · 1.8 KB
/
errors.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
#pragma once
class wrongNumberOfArgs : public std::exception { char const *what() const throw() {
return "Wrong number of arguments. Usage:\n ./ircserv <port> <password>";
}};
class wrongPortNumber : public std::exception { char const *what() const throw() {
return "Provided port number was incorrect";
}};
class connectionFailed : public std::exception {char const *what() const throw() {
return "Failed to accept a user trying to connect";
}};
class socketCreationFailed : public std::exception {char const *what() const throw() {
return "Failed to create a socket";
}};
class bindingSocketFailed : public std::exception {char const *what() const throw() {
return "Failed to bind the socket to IP/port";
}};
class listenOnSocketFailed : public std::exception {char const *what() const throw() {
return "Failed to listen on the socket";
}};
class acceptOnSocketFailed : public std::exception {char const *what() const throw() {
return "Failed to accept on the socket";
}};
class activePollFull : public std::exception {char const *what() const throw() {
return "Number of connection is full, can't accept more connections";
}};
class indexOutOfBounds : public std::exception {char const *what() const throw() {
return "Given index is out of bounds";
}};
class pollFailed : public std::exception {char const *what() const throw() {
return "poll() failed";
}};
class readingMsgFailed : public std::exception {char const *what() const throw() {
return "Failed to read the input from the user";
}};
class sendingMsgFailed : public std::exception {char const *what() const throw() {
return "Failed to send a response to the user";
}};
class incorrectPassword : public std::exception {char const *what() const throw() {
return "Provided password is incorrect";
}};