HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NET_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: NET_Error.h
7  *
8  * COMMENTS:
9  *
10  */
11 
12 #ifndef __NET_ERROR_H__
13 #define __NET_ERROR_H__
14 
15 #include "NET_API.h"
16 
18 
19 #include <UT/UT_Assert.h>
20 #include <UT/UT_Error.h>
21 #include <UT/UT_ErrorManager.h>
22 #include <UT/UT_StringHolder.h>
23 
25 {
26  // Curl errors
28 
29  // Sqlite errors
31 
32  // Network Manager errors
34 
35  // Stats Manager errors
37 
38  // SSL Engine errors
40 };
41 
43 {
44 public:
45  static UT_StringHolder errorCode(int code)
46  {
47  switch(code)
48  {
49  case NET_ERR_CURL:
50  return "HTTP Client";
51  case NET_ERR_SQLITE:
52  return "Sqlite";
53  case NET_ERR_NET_MGR:
54  return "General";
55  case NET_ERR_STATS_MGR:
56  return "Stats";
57  case NET_ERR_SSL:
58  return "SSL Engine";
59  default:
60  break;
61  };
63  }
64 };
65 
66 template <typename... Args>
67 void
68 NETaddMessage(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
69 {
71  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
72 }
73 template <typename... Args>
74 void
75 NETaddPrompt(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
76 {
78  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
79 }
80 
81 template <typename... Args>
82 void
83 NETaddWarning(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
84 {
86  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
87 }
88 
89 template <typename... Args>
90 void
91 NETaddError(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
92 {
94  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
95 }
96 
97 template <typename... Args>
98 void
99 NETaddFatal(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
100 {
101  NETlogFatal(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
102 }
103 
104 // -----------------------------------------------------------------------------
105 // Adds errors to general error manager.
106 // -----------------------------------------------------------------------------
107 
108 template <typename... Args>
109 void
110 NETaddMessage(int code, const char* fmt, Args&&... args)
111 {
112  NETlogMessage(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
113 }
114 template <typename... Args>
115 void
116 NETaddPrompt(int code, const char* fmt, Args&&... args)
117 {
118  NETlogPrompt(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
119 }
120 
121 template <typename... Args>
122 void
123 NETaddWarning(int code, const char* fmt, Args&&... args)
124 {
125  NETlogWarning(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
126 }
127 
128 template <typename... Args>
129 void
130 NETaddError(int code, const char* fmt, Args&&... args)
131 {
132  NETlogError(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
133 }
134 
135 template <typename... Args>
136 void
137 NETaddFatal(int code, const char* fmt, Args&&... args)
138 {
139  NETlogFatal(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
140 }
141 
142 #endif // __NET_ERROR_H__
143 
void NETaddWarning(NET_LogManager &mgr, int code, const char *fmt, Args &&...args)
Definition: NET_Error.h:83
void NETlogPrompt(NET_LogManager &mgr, const UT_StringHolder &context, const char *fmt, Args &&...args)
void NETlogMessage(NET_LogManager &mgr, const UT_StringHolder &context, const char *fmt, Args &&...args)
static UT_StringHolder errorCode(int code)
Definition: NET_Error.h:45
#define NET_API
Definition: NET_API.h:9
static const UT_StringHolder theEmptyString
void NETlogFatal(NET_LogManager &mgr, const UT_StringHolder &context, const char *fmt, Args &&...args)
NET_ErrorCodes
Definition: NET_Error.h:24
void NETaddFatal(NET_LogManager &mgr, int code, const char *fmt, Args &&...args)
Definition: NET_Error.h:99
void NETlogWarning(NET_LogManager &mgr, const UT_StringHolder &context, const char *fmt, Args &&...args)
void NETaddPrompt(NET_LogManager &mgr, int code, const char *fmt, Args &&...args)
Definition: NET_Error.h:75
**If you just want to fire and args
Definition: thread.h:615
void NETlogError(NET_LogManager &mgr, const UT_StringHolder &context, const char *fmt, Args &&...args)
void NETaddError(NET_LogManager &mgr, int code, const char *fmt, Args &&...args)
Definition: NET_Error.h:91
void NETaddMessage(NET_LogManager &mgr, int code, const char *fmt, Args &&...args)
Definition: NET_Error.h:68