API Documentation
Loading...
Searching...
No Matches
Exception.hpp
Go to the documentation of this file.
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Base
28File: Exception
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/BaseValues.h>
35#include <NDEVR/String.h>
36#include <NDEVR/TranslatedString.h>
37#include <exception>
38namespace NDEVR
39{
40 /**--------------------------------------------------------------------------------------------------
41 Class: Exception
42
43 \brief Provides consistent interface to handle errors through the throw expression.
44 All exceptions generated by the Parke library inherit from Exception
45
46 Author: Tyler Parke
47
48 Date: 2017-11-17
49 *-----------------------------------------------------------------------------------------------**/
50 class UUID;
52 {
53 public:
54 virtual ~Exception() = default;
55
56 /**--------------------------------------------------------------------------------------------------
57 Constructor.
58
59 Author: Tyler Parke
60
61 Date: 2017-11-17
62
63 Parameters:
64 message - The message that identifies the exception.
65 *-----------------------------------------------------------------------------------------------**/
66 //NDEVR_BASE_API explicit Exception(const bool& capture_stack = true);
67 //explicit Exception(const String& message);
68
69 NDEVR_BASE_API Exception(const String& title, const bool& capture_stack = true);
70 NDEVR_BASE_API Exception(const TranslatedString& title, const bool& capture_stack = true);
71 NDEVR_BASE_API Exception(const std::exception& exception);
72 NDEVR_BASE_API Exception(const TranslatedString& title, const TranslatedString& message, const bool& capture_stack = true);
73 /**--------------------------------------------------------------------------------------------------
74 Sets a title for the exception.
75
76 Author: Tyler Parke
77
78 Date: 2018-07-09
79
80 Parameters:
81 title - The title of the exception.
82 *-----------------------------------------------------------------------------------------------**/
83 void setTitle(const TranslatedString& title)
84 {
85 m_title = title;
86 }
87 virtual void setMessage(const TranslatedString& message)
88 {
89 m_message = message;
90 }
91
92
93
94 /**--------------------------------------------------------------------------------------------------
95 Sets a message.
96
97 Author: Tyler Parke
98
99 Date: 2017-11-17
100
101 Parameters:
102 message - The message.
103 *-----------------------------------------------------------------------------------------------**/
104
105 void setCategory(const TranslatedString& category)
106 {
107 m_category = category;
108 }
110 {
112 }
113 /**--------------------------------------------------------------------------------------------------
114 Gets the message identifying the exception
115
116 Author: Tyler Parke
117
118 Date: 2017-11-17
119
120 Returns: Null if it fails, else the message.
121 *-----------------------------------------------------------------------------------------------**/
122
124 {
125 return m_message;
126 }
127 virtual const TranslatedString& getTitle() const
128 {
129 return m_title;
130 }
131 virtual const TranslatedString& getCategory() const
132 {
133 return m_category;
134 }
135 virtual const String& stackTrace() const
136 {
137 return m_stack_trace;
138 }
139 virtual uint04 getPriority() const
140 {
141 return m_priority;
142 }
143
144 const String& thread() const
145 {
146 return m_thread;
147 }
150 protected:
157 };
158
159};
160
#define NDEVR_BASE_API
Definition DLLInfo.h:78
Definition Exception.hpp:52
virtual uint04 getPriority() const
Definition Exception.hpp:139
TranslatedString m_category
Definition Exception.hpp:153
String m_thread
Definition Exception.hpp:154
virtual ~Exception()=default
String m_stack_trace
Definition Exception.hpp:155
void setThread(const String &thread)
Definition Exception.hpp:109
virtual const String & stackTrace() const
Definition Exception.hpp:135
void setTitle(const TranslatedString &title)
Definition Exception.hpp:83
virtual const TranslatedString & getCategory() const
Definition Exception.hpp:131
NDEVR_BASE_API Exception(const String &title, const bool &capture_stack=true)
TranslatedString m_title
Definition Exception.hpp:152
uint04 m_priority
Definition Exception.hpp:156
void setCategory(const TranslatedString &category)
Definition Exception.hpp:105
NDEVR_BASE_API Exception(const std::exception &exception)
virtual void setMessage(const TranslatedString &message)
Definition Exception.hpp:87
NDEVR_BASE_API UUID id() const
TranslatedString m_message
Definition Exception.hpp:151
NDEVR_BASE_API Exception(const TranslatedString &title, const TranslatedString &message, const bool &capture_stack=true)
NDEVR_BASE_API Exception(const TranslatedString &title, const bool &capture_stack=true)
const String & thread() const
Definition Exception.hpp:144
virtual TranslatedString getMessage() const
Definition Exception.hpp:123
virtual const TranslatedString & getTitle() const
Definition Exception.hpp:127
The core String class for the software.
Definition String.h:47
Any text displayed to the user should be defined as a TranslatedString which allows the.
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:62
Definition ACIColor.h:37
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:94