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  // Authentication errors
43 };
44 
46 {
47 public:
48  static UT_StringHolder errorCode(int code)
49  {
50  switch(code)
51  {
52  case NET_ERR_CURL:
53  return "HTTP Client";
54  case NET_ERR_SQLITE:
55  return "Sqlite";
56  case NET_ERR_NET_MGR:
57  return "General";
58  case NET_ERR_STATS_MGR:
59  return "Stats";
60  case NET_ERR_SSL:
61  return "SSL Engine";
62  case NET_ERR_AUTH:
63  return "Auth";
64  default:
65  break;
66  };
68  }
69 };
70 
71 template <typename... Args>
72 void
73 NETaddMessage(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
74 {
76  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
77 }
78 template <typename... Args>
79 void
80 NETaddPrompt(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
81 {
83  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
84 }
85 
86 template <typename... Args>
87 void
88 NETaddWarning(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
89 {
91  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
92 }
93 
94 template <typename... Args>
95 void
96 NETaddError(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
97 {
99  mgr, NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
100 }
101 
102 template <typename... Args>
103 void
104 NETaddFatal(NET_LogManager& mgr, int code, const char* fmt, Args&&... args)
105 {
106  NETlogFatal(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
107 }
108 
109 // -----------------------------------------------------------------------------
110 // Adds errors to general error manager.
111 // -----------------------------------------------------------------------------
112 
113 template <typename... Args>
114 void
115 NETaddMessage(int code, const char* fmt, Args&&... args)
116 {
117  NETlogMessage(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
118 }
119 template <typename... Args>
120 void
121 NETaddPrompt(int code, const char* fmt, Args&&... args)
122 {
123  NETlogPrompt(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
124 }
125 
126 template <typename... Args>
127 void
128 NETaddWarning(int code, const char* fmt, Args&&... args)
129 {
130  NETlogWarning(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
131 }
132 
133 template <typename... Args>
134 void
135 NETaddError(int code, const char* fmt, Args&&... args)
136 {
137  NETlogError(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
138 }
139 
140 template <typename... Args>
141 void
142 NETaddFatal(int code, const char* fmt, Args&&... args)
143 {
144  NETlogFatal(NET_Error::errorCode(code), fmt, std::forward<Args>(args)...);
145 }
146 
147 #endif // __NET_ERROR_H__
148 
void NETaddWarning(NET_LogManager &mgr, int code, const char *fmt, Args &&...args)
Definition: NET_Error.h:88
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:48
#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:104
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:80
**If you just want to fire and args
Definition: thread.h:618
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:96
void NETaddMessage(NET_LogManager &mgr, int code, const char *fmt, Args &&...args)
Definition: NET_Error.h:73