HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ErrorCode.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: UT_ErrorCode.h
7  *
8  * COMMENTS: A wrapper around std::error_code and std::error_category.
9  *
10  *
11  */
12 
13 #ifndef __UT_ERRORCODE_H__
14 #define __UT_ERRORCODE_H__
15 
16 #include "UT_API.h"
17 
18 #include <system_error>
19 
20 using UT_ErrorCode = std::error_code;
21 using UT_ErrorCondition = std::error_condition;
22 using UT_ErrorCategory = std::error_category;
23 
24 class UT_StringHolder;
25 
26 /// Make a UT_ErrorCode based on the provided namespaced enum class.
27 template <typename EnumT>
28 auto
29 UTmakeErrorCode(EnumT e) -> decltype(make_error_code(e))
30 {
32  {
33  static_assert(
35  "Enum must be an error code enum.");
36  }
37  return make_error_code(e);
38 }
39 
40 /// Helper method to log an error code.
41 UT_API void UTlogErrorCode(const UT_ErrorCode& ec, const UT_StringHolder& what);
42 
43 #endif // __UT_ERRORCODE_H__
44 
GLsizei const GLfloat * value
Definition: glcorearb.h:824
std::error_condition UT_ErrorCondition
Definition: UT_ErrorCode.h:21
#define UT_API
Definition: UT_API.h:14
std::error_category UT_ErrorCategory
Definition: UT_ErrorCode.h:22
UT_ErrorCode make_error_code(NET::CurlError e)
std::error_code UT_ErrorCode
Definition: UT_ErrorCode.h:20
auto UTmakeErrorCode(EnumT e) -> decltype(make_error_code(e))
Make a UT_ErrorCode based on the provided namespaced enum class.
Definition: UT_ErrorCode.h:29
UT_API void UTlogErrorCode(const UT_ErrorCode &ec, const UT_StringHolder &what)
Helper method to log an error code.