diff --git a/vtkm/cont/Error.h b/vtkm/cont/Error.h index 4a7692ce7..41fcb1e95 100644 --- a/vtkm/cont/Error.h +++ b/vtkm/cont/Error.h @@ -24,14 +24,17 @@ // templated. If there is any reason to create a VTKm control library, // this class and its subclasses should probably go there. +#include #include +#include // For VTKM_OVERRIDE + namespace vtkm { namespace cont { /// The superclass of all exceptions thrown by any VTKm function or method. /// -class Error +class Error : public std::exception { public: //See note about GetMessage macro below. @@ -47,6 +50,12 @@ public: const std::string &GetMessageW() const { return this->Message; } #endif + // For std::exception compatibility: + const char* what() const VTKM_NOEXCEPT VTKM_OVERRIDE + { + return this->Message.c_str(); + } + protected: Error() { } Error(const std::string message) : Message(message) { } diff --git a/vtkm/internal/ExportMacros.h b/vtkm/internal/ExportMacros.h index 05256f903..9f0466a7e 100644 --- a/vtkm/internal/ExportMacros.h +++ b/vtkm/internal/ExportMacros.h @@ -48,8 +48,10 @@ // sure when that we gracefully fall back to just const when using 2013 #if defined(VTKM_MSVC) && _MSC_VER < 1900 #define VTKM_CONSTEXPR const +#define VTKM_NOEXCEPT #else #define VTKM_CONSTEXPR constexpr +#define VTKM_NOEXCEPT noexcept #endif #define VTKM_OVERRIDE override