Base class for all errors that will be reported (thrown or returned) from MIP SDK.
More...
#include <src/api/mip/error.h>
|
void | AddDebugInfo (const std::string &key, const std::string &value, bool sensitive=false) |
| Add debug info entry.
|
|
virtual std::shared_ptr< Error > | Clone () const =0 |
| Clone the error.
|
|
const std::map< std::string, std::string > & | GetDebugInfo () const |
| Get debug info.
|
|
const std::string & | GetErrorName () const |
| Get the error name.
|
|
virtual ErrorType | GetErrorType () const |
| Get the error type.
|
|
const std::string & | GetMessage (bool maskPII=false) const |
| Get the error message.
|
|
void | SetMessage (const std::string &msg) |
| Set the error message.
|
|
char const * | what () const noexcept override |
| Get the error message.
|
|
Base class for all errors that will be reported (thrown or returned) from MIP SDK.
Definition at line 114 of file error.h.
◆ AddDebugInfo()
void Error::AddDebugInfo |
( |
const std::string & | key, |
|
|
const std::string & | value, |
|
|
bool | sensitive = false ) |
|
inline |
◆ Clone()
virtual std::shared_ptr< Error > Error::Clone |
( |
| ) |
const |
|
pure virtual |
◆ GetDebugInfo()
const std::map< std::string, std::string > & Error::GetDebugInfo |
( |
| ) |
const |
|
inline |
Get debug info.
- Returns
- Debug info (keys/values)
Definition at line 192 of file error.h.
References mDebugInfo.
◆ GetErrorName()
const std::string & Error::GetErrorName |
( |
| ) |
const |
|
inline |
Get the error name.
- Returns
- the error name.
Definition at line 144 of file error.h.
References mName.
◆ GetErrorType()
virtual ErrorType Error::GetErrorType |
( |
| ) |
const |
|
inlinevirtual |
Get the error type.
- Returns
- the error type.
Definition at line 137 of file error.h.
References mType.
◆ GetMessage()
const std::string & Error::GetMessage |
( |
bool | maskPII = false | ) |
const |
|
inline |
Get the error message.
- Returns
- the error message.
Definition at line 151 of file error.h.
151 {
152 return maskPII ? mMaskedMessage : mFormattedMessage;
153 }
◆ SetMessage()
void Error::SetMessage |
( |
const std::string & | msg | ) |
|
|
inline |
Set the error message.
- Parameters
-
Definition at line 160 of file error.h.
160 {
161 std::string* targetStrings[] = { &mFormattedMessage, &mMaskedMessage };
162 for (auto* targetString : targetStrings) {
163 size_t pos = targetString->find(
mMessage);
164 if (pos != std::string::npos) {
165 targetString->replace(pos,
mMessage.length(), msg);
166 } else {
167 targetString->replace(0, 0, msg);
168 }
169 }
171 }
References mMessage.
◆ what()
char const * Error::what |
( |
| ) |
const |
|
inlineoverridenoexcept |
Get the error message.
- Returns
- the error message
Definition at line 121 of file error.h.
121 {
122 return mFormattedMessage.c_str();
123 }
◆ mDebugInfo
std::map<std::string, std::string> Error::mDebugInfo |
◆ mMessage
std::string Error::mMessage |
◆ mName
◆ mType
The documentation for this class was generated from the following file: