-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.h
67 lines (58 loc) · 2.08 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
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include <exception>
#include <string>
#include <format>
#include "execution_control/shared_structures.h"
class CustomException : public std::exception {};
class InvalidCommandFormatException : public CustomException {
private:
const std::string MSG{"Invalid command format, the correct format is:\n" + COMMAND_FORMAT};
public:
[[nodiscard]] const char *what() const
noexcept override{return MSG.c_str();};
};
class InvalidFilterException : public CustomException {
private:
const std::string_view FORMAT{"Invalid filter '{}', list of valid filters:\n"};
std::string _msg;
public:
explicit InvalidFilterException(const std::string &filter);
[[nodiscard]] const char *what() const
noexcept override{return this->_msg.c_str();};
};
class IncorrectFilterArgsCntException : public CustomException {
private:
const std::string_view FORMAT{"Incorrect filter arguments count for filter '{}', the correct count is {}"};
std::string _msg;
public:
explicit IncorrectFilterArgsCntException(const std::string &filter);
[[nodiscard]] const char *what() const
noexcept override{return this->_msg.c_str();};
};
class InvalidFilterArgsFormatException : public CustomException {
private:
const std::string FORMAT{"Incorrect filter arguments format for filter '{}'"};
std::string _msg;
public:
explicit InvalidFilterArgsFormatException(const std::string &filter);
[[nodiscard]] const char *what() const
noexcept override{return this->_msg.c_str();};
};
class FileOpenException : public CustomException {
private:
const std::string FORMAT{"Unable to open file '{}'"};
std::string _msg;
public:
explicit FileOpenException(const std::string &filename);
[[nodiscard]] const char *what() const
noexcept override{return this->_msg.c_str();};
};
class InvalidImageFormatException : public CustomException {
private:
const std::string FORMAT{"Invalid input image format of '{}'"};
std::string _msg;
public:
explicit InvalidImageFormatException(const std::string &filename);
[[nodiscard]] const char *what() const
noexcept override{return this->_msg.c_str();};
};