HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_Error.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CE_Error.h ( CE Library, C++)
7  *
8  * COMMENTS: Compute Engine Error.
9  */
10 
11 #ifndef __CE_Error__
12 #define __CE_Error__
13 
14 #include "CE_API.h"
15 
16 #include <UT/UT_StringHolder.h>
17 #include <UT/UT_WorkBuffer.h>
18 
19 /// Utility methods to convert the error code + string into a user
20 /// friendly error message. This lets us centralize hints of what
21 /// to do when certain errors are encountered.
22 CE_API UT_StringHolder CE_FormatOCLError(int errorcode, const char *errorstring = nullptr);
23 CE_API void CE_FormatOCLError(UT_WorkBuffer &buf, int errorcode, const char *errorstring = nullptr);
24 
25 /// A class derived from cl::Error that allows arbitrary error messages to be
26 /// stored with the exception (as opposed to only globals like string
27 /// literals).
28 class CE_API CE_Error: public cl::Error
29 {
30 public:
31  CE_Error(cl_int err, const char *err_str = nullptr)
32  : cl::Error(err, nullptr), myErrStr(err_str)
33  {
34  }
35 
36  const char * what() const throw () override
37  {
38  return myErrStr.buffer();
39  }
40 
41 private:
42  UT_StringHolder myErrStr;
43 };
44 
45 
46 #endif
#define CE_API
Definition: CE_API.h:13
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glcorearb.h:2540
CE_Error(cl_int err, const char *err_str=nullptr)
Definition: CE_Error.h:31
int32_t cl_int
Definition: cl_platform.h:260
CE_API UT_StringHolder CE_FormatOCLError(int errorcode, const char *errorstring=nullptr)
Error
Definition: oidn.hpp:578
const char * what() const override
Definition: CE_Error.h:36