-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.h
55 lines (46 loc) · 1.28 KB
/
exceptions.h
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 <utility>
class RobotsException : public std::exception {
private:
std::string message;
public:
explicit RobotsException(std::string newMessage) :
message(std::move(newMessage)) {
}
[[nodiscard]] const char * what() const noexcept override {
return message.c_str();
}
};
/* Exception thrown when parsing a variant message type goes wrong. */
class BadType : public RobotsException {
public:
BadType() : RobotsException("Error: message type resolution failed.\n") {
}
};
/* Exception thrown when writing exceeds buffer capacity. */
class BadWrite : public RobotsException {
public:
BadWrite() :
RobotsException("Error: not enough buffer space to write to.\n") {
}
};
/* Exception thrown when writing exceeds buffer capacity. */
class BadRead : public RobotsException {
public:
BadRead() :
RobotsException("Error: not enough buffered list to read from.\n") {
}
};
/* Exception thrown when user requests help message. */
class NeedHelp : public RobotsException {
public:
NeedHelp() : RobotsException("Info: user requested for help message.\n") {
}
};
/* Exception thrown when program receives SIGINT. */
class InterruptedException : public RobotsException {
public:
InterruptedException() : RobotsException("\nInterrupted.\n") {
}
};