-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExceptions.h
86 lines (74 loc) · 1.77 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#pragma once
#include "pch.h"
class BaseException : public std::exception
{
public:
BaseException() noexcept = default;
BaseException(String const& sourceFile, String const& what) : std::exception(what.c_str())
{
_SourceFile = sourceFile;
}
String SourceFile() const
{
return _SourceFile;
}
private:
String _SourceFile;
};
class ConfigurationLoadException : public BaseException
{
public:
ConfigurationLoadException() noexcept = default;
ConfigurationLoadException(String const& sourceFile, String const& what) : BaseException(sourceFile, what.c_str())
{}
};
class FileNotFoundException : public BaseException
{
public:
FileNotFoundException() noexcept = default;
FileNotFoundException(String const& sourceFile, String const& what, String const& filePath) : BaseException(sourceFile, what.c_str())
{
_Path = filePath;
}
String FilePath() const
{
return _Path;
}
private:
String _Path;
};
class InvalidMessageException : public BaseException
{
public:
InvalidMessageException() noexcept = default;
InvalidMessageException(String const& sourceFile, String const& what,
MessageTypes const& msgType) : BaseException(sourceFile, what.c_str())
{}
};
class AccessDeniedException : public BaseException
{
public:
AccessDeniedException() noexcept = default;
AccessDeniedException(String const& sourceFile, String const& what, String const& target)
: BaseException(sourceFile, what.c_str())
{
_Target = target;
}
AccessDeniedException(String const& sourceFile, String const& what, String const& target, LogLevels logLevel)
: BaseException(sourceFile, what.c_str())
{
_Target = target;
_Loglevel = logLevel;
}
String Target() const
{
return _Target;
}
LogLevels LogLevel() const
{
return _Loglevel;
}
private:
String _Target;
LogLevels _Loglevel;
};