store What as a member var
This commit is contained in:
parent
ede1f78323
commit
325c75fd70
@ -48,11 +48,7 @@ public:
|
||||
#endif
|
||||
|
||||
// For std::exception compatibility:
|
||||
const char* what() const noexcept override
|
||||
{
|
||||
std::string tmp = this->Message + "\n" + this->StackTrace;
|
||||
return tmp.c_str();
|
||||
}
|
||||
const char* what() const noexcept override { return this->What.c_str(); }
|
||||
|
||||
/// Returns true if this exception is device independent. For exceptions that
|
||||
/// are not device independent, `vtkm::TryExecute`, for example, may try
|
||||
@ -64,6 +60,7 @@ protected:
|
||||
Error(const std::string& message, bool is_device_independent = false)
|
||||
: Message(message)
|
||||
, StackTrace(vtkm::cont::GetStackTrace(1))
|
||||
, What(Message + "\n" + StackTrace)
|
||||
, IsDeviceIndependent(is_device_independent)
|
||||
{
|
||||
}
|
||||
@ -73,6 +70,7 @@ protected:
|
||||
private:
|
||||
std::string Message;
|
||||
std::string StackTrace;
|
||||
std::string What;
|
||||
bool IsDeviceIndependent;
|
||||
};
|
||||
|
||||
|
@ -51,16 +51,13 @@ void ValidateError(const vtkm::cont::Error& error)
|
||||
VTKM_TEST_ASSERT(count > 11, "StackTrace did not recurse enough");
|
||||
}
|
||||
VTKM_TEST_ASSERT(test_equal(message, error.GetMessage()), "Message was incorrect");
|
||||
std::string k = error.what();
|
||||
std::cout << "what directly:" << error.what() << std::endl;
|
||||
std::cout << "what as var: " << k << std::endl;
|
||||
VTKM_TEST_ASSERT(test_equal(message + "\n" + stackTrace, std::string(error.what())),
|
||||
"what() was incorrect");
|
||||
}
|
||||
|
||||
void DoErrorTest()
|
||||
{
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Check base error mesgs");
|
||||
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Check base error messages");
|
||||
try
|
||||
{
|
||||
RecursiveFunction(0);
|
||||
|
Loading…
Reference in New Issue
Block a user