VTK-m  2.0
ThrustExceptionHandler.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_cont_cuda_interal_ThrustExecptionHandler_h
11 #define vtk_m_cont_cuda_interal_ThrustExecptionHandler_h
12 
16 
18 VTKM_THIRDPARTY_PRE_INCLUDE
19 #include <thrust/system_error.h>
20 VTKM_THIRDPARTY_POST_INCLUDE
21 
22 namespace vtkm
23 {
24 namespace cont
25 {
26 namespace cuda
27 {
28 namespace internal
29 {
30 
31 static inline void throwAsVTKmException()
32 {
33  try
34  {
35  //re-throw the last exception
36  throw;
37  }
38  catch (std::bad_alloc& error)
39  {
40  throw vtkm::cont::ErrorBadAllocation(error.what());
41  }
42  catch (thrust::system_error& error)
43  {
44  throw vtkm::cont::ErrorExecution(error.what());
45  }
46 }
47 }
48 }
49 }
50 }
51 
52 #endif //vtk_m_cont_cuda_interal_ThrustExecptionHandler_h
ErrorBadAllocation.h
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
ThrustPatches.h
ExportMacros.h
ErrorExecution.h
vtkm::cont::ErrorBadAllocation
This class is thrown when VTK-m attempts to manipulate memory that it should not.
Definition: ErrorBadAllocation.h:25
vtkm::cont::ErrorExecution
This class is thrown in the control environment whenever an error occurs in the execution environment...
Definition: ErrorExecution.h:25