Delegate Response Error. Thrown or returned in response to encountering an error in a delegate method.
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.
|
|
| DelegateResponseError (const std::exception_ptr &except) |
| Creates an error/exception object. Call this method from a MIP delegate function to create a MIP or standard C++ exception object.
|
|
| DelegateResponseError (const std::string &message) |
| Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
|
|
| DelegateResponseError (const std::string &message, const std::string &stackTrace, const std::string &name="DelegateResponseError") |
| Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
|
|
| DelegateResponseError (const std::string &message, long HResult) |
| Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
|
|
| DelegateResponseError (const std::string &message, long HResult, const std::string &stackTrace, const std::string &name="DelegateResponseError") |
| Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
|
|
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.
|
|
Delegate Response Error. Thrown or returned in response to encountering an error in a delegate method.
Definition at line 315 of file error.h.
◆ DelegateResponseError() [1/5]
DelegateResponseError::DelegateResponseError |
( |
const std::exception_ptr & | except | ) |
|
|
inlineexplicit |
Creates an error/exception object. Call this method from a MIP delegate function to create a MIP or standard C++ exception object.
- Parameters
-
except | The C++ exception that was encountered. |
Definition at line 323 of file error.h.
323 :
325 mCurrentException(except) {
326 if (except) {
327 try {
328 std::rethrow_exception(except);
329 }
catch(
const Error& error) {
330 *
static_cast<Error*
>(
this) = error;
331 } catch (const std::exception& thisException) {
332 this->
mMessage = std::string(thisException.what());
333 }
334 }
335 }
Base class for all errors that will be reported (thrown or returned) from MIP SDK.
References Error::mMessage.
◆ DelegateResponseError() [2/5]
DelegateResponseError::DelegateResponseError |
( |
const std::string & | message, |
|
|
const std::string & | stackTrace, |
|
|
const std::string & | name = "DelegateResponseError" ) |
|
inline |
Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
- Parameters
-
message | Message associated with the exception. |
stackTrace | The stack trace at the time of the exception. |
name | Some string to uniquely identify the type of this exception. |
Definition at line 345 of file error.h.
351 }
void AddDebugInfo(const std::string &key, const std::string &value, bool sensitive=false)
Add debug info entry.
constexpr const char * GetStackTraceString()
References Error::AddDebugInfo(), and anonymous_namespace{error.h}::GetStackTraceString().
◆ DelegateResponseError() [3/5]
DelegateResponseError::DelegateResponseError |
( |
const std::string & | message, |
|
|
long | HResult, |
|
|
const std::string & | stackTrace, |
|
|
const std::string & | name = "DelegateResponseError" ) |
|
inline |
Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
- Parameters
-
message | Message associated with the exception. |
HResult | HResult that identifies the error that caused this exception. |
stackTrace | The stack trace at the time of the exception. |
name | Some string to uniquely identify the type of this exception. |
Definition at line 362 of file error.h.
368 std::stringstream hrStream;
369 hrStream << std::hex << HResult;
372 }
constexpr const char * GetHResultString()
References Error::AddDebugInfo(), anonymous_namespace{error.h}::GetHResultString(), and anonymous_namespace{error.h}::GetStackTraceString().
◆ DelegateResponseError() [4/5]
DelegateResponseError::DelegateResponseError |
( |
const std::string & | message, |
|
|
long | HResult ) |
|
inline |
Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
- Parameters
-
message | Message associated with the exception. |
HResult | HResult that identifies the error that caused this exception. |
Definition at line 381 of file error.h.
383 std::stringstream hrStream;
384 hrStream << std::hex << HResult;
386 }
References Error::AddDebugInfo(), and anonymous_namespace{error.h}::GetHResultString().
◆ DelegateResponseError() [5/5]
DelegateResponseError::DelegateResponseError |
( |
const std::string & | message | ) |
|
|
inline |
Creates an error/exception object. Call this method from a MIP delegate function to create a generic MIP C++ exception object.
- Parameters
-
message | Message associated with the exception. |
Definition at line 394 of file error.h.
◆ AddDebugInfo()
void Error::AddDebugInfo |
( |
const std::string & | key, |
|
|
const std::string & | value, |
|
|
bool | sensitive = false ) |
|
inlineinherited |
Add debug info entry.
- Parameters
-
key | Debug info key |
value | Debug info value |
Definition at line 179 of file error.h.
179 {
180 if (!key.empty() && !value.empty()) {
182 mFormattedMessage = mFormattedMessage + ", " + key + "=" + value;
183 mMaskedMessage = mMaskedMessage + ", " + key + "=" + (sensitive ? "***" : value);
184 }
185 }
std::map< std::string, std::string > mDebugInfo
References Error::mDebugInfo.
Referenced by DelegateResponseError(), DelegateResponseError(), and DelegateResponseError().
◆ Clone()
virtual std::shared_ptr< Error > Error::Clone |
( |
| ) |
const |
|
pure virtualinherited |
◆ GetDebugInfo()
const std::map< std::string, std::string > & Error::GetDebugInfo |
( |
| ) |
const |
|
inlineinherited |
◆ GetErrorName()
const std::string & Error::GetErrorName |
( |
| ) |
const |
|
inlineinherited |
◆ GetErrorType()
virtual ErrorType Error::GetErrorType |
( |
| ) |
const |
|
inlinevirtualinherited |
◆ GetMessage()
const std::string & Error::GetMessage |
( |
bool | maskPII = false | ) |
const |
|
inlineinherited |
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 | ) |
|
|
inlineinherited |
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 Error::mMessage.
◆ what()
char const * Error::what |
( |
| ) |
const |
|
inlineoverridenoexceptinherited |
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 |
|
inherited |
◆ mMessage
std::string Error::mMessage |
|
inherited |
◆ mName
◆ mType
The documentation for this class was generated from the following file: