forked from Yasna1998/stackoverflow-in-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExceptions.h
More file actions
55 lines (43 loc) · 1.18 KB
/
Exceptions.h
File metadata and controls
55 lines (43 loc) · 1.18 KB
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
#pragma once
#include <exception>
#include <string>
class UsernameAlreadyExistsException : public std::exception {
public:
const char *what() const throw() {
return message.c_str();
}
private:
const std::string message = "Error: username already exists";
};
class EmailAlreadyExistsException : public std::exception {
public:
const char *what() const throw() {
return message.c_str();
}
private:
const std::string message = "Error: email already exists";
};
class WrongUsernameOrPasswordException : public std::exception {
private:
const std::string message = "Error: wrong username or password!";
public:
const char *what() const throw() {
return message.c_str();
}
};
class DeleteAdminException : public std::exception {
public:
const char *what() throw() {
return message.c_str();
}
private:
const std::string message = "Error: can't delete admin account!";
};
class NotAdminForDuplicateEception : public std::exception{
private:
const std::string message = "You have to be an admin to make two contents dublicate of each other";
public:
const char *What() throw() {
return message.c_str();
}
};