Sync usage with man page.
[netbsd-mini2440.git] / crypto / external / bsd / openssl / dist / MacOS / GetHTTPS.src / ErrorHandling.hpp
blobfbfbe786b757a6bd31656f9b81e55765fd19bdd0
1 #ifdef __cplusplus
2 extern "C" {
3 #endif
5 #ifndef kGenericError
6 #define kGenericError -1
7 #endif
9 extern char *gErrorMessage;
12 void SetErrorMessage(const char *theErrorMessage);
13 void SetErrorMessageAndAppendLongInt(const char *theErrorMessage,const long theLongInt);
14 void SetErrorMessageAndCStrAndLongInt(const char *theErrorMessage,const char * theCStr,const long theLongInt);
15 void SetErrorMessageAndCStr(const char *theErrorMessage,const char * theCStr);
16 void AppendCStrToErrorMessage(const char *theErrorMessage);
17 void AppendLongIntToErrorMessage(const long theLongInt);
20 char *GetErrorMessage(void);
21 OSErr GetErrorMessageInNewHandle(Handle *inoutHandle);
22 OSErr GetErrorMessageInExistingHandle(Handle inoutHandle);
23 OSErr AppendErrorMessageToHandle(Handle inoutHandle);
26 #ifdef __EXCEPTIONS_ENABLED__
27 void ThrowErrorMessageException(void);
28 #endif
32 // A bunch of evil macros that would be unnecessary if I were always using C++ !
34 #define SetErrorMessageAndBailIfNil(theArg,theMessage) \
35 { \
36 if (theArg == nil) \
37 { \
38 SetErrorMessage(theMessage); \
39 errCode = kGenericError; \
40 goto EXITPOINT; \
41 } \
45 #define SetErrorMessageAndBail(theMessage) \
46 { \
47 SetErrorMessage(theMessage); \
48 errCode = kGenericError; \
49 goto EXITPOINT; \
53 #define SetErrorMessageAndLongIntAndBail(theMessage,theLongInt) \
54 { \
55 SetErrorMessageAndAppendLongInt(theMessage,theLongInt); \
56 errCode = kGenericError; \
57 goto EXITPOINT; \
61 #define SetErrorMessageAndLongIntAndBailIfError(theErrCode,theMessage,theLongInt) \
62 { \
63 if (theErrCode != noErr) \
64 { \
65 SetErrorMessageAndAppendLongInt(theMessage,theLongInt); \
66 errCode = theErrCode; \
67 goto EXITPOINT; \
68 } \
72 #define SetErrorMessageCStrLongIntAndBailIfError(theErrCode,theMessage,theCStr,theLongInt) \
73 { \
74 if (theErrCode != noErr) \
75 { \
76 SetErrorMessageAndCStrAndLongInt(theMessage,theCStr,theLongInt); \
77 errCode = theErrCode; \
78 goto EXITPOINT; \
79 } \
83 #define SetErrorMessageAndCStrAndBail(theMessage,theCStr) \
84 { \
85 SetErrorMessageAndCStr(theMessage,theCStr); \
86 errCode = kGenericError; \
87 goto EXITPOINT; \
91 #define SetErrorMessageAndBailIfError(theErrCode,theMessage) \
92 { \
93 if (theErrCode != noErr) \
94 { \
95 SetErrorMessage(theMessage); \
96 errCode = theErrCode; \
97 goto EXITPOINT; \
98 } \
102 #define SetErrorMessageAndLongIntAndBailIfNil(theArg,theMessage,theLongInt) \
104 if (theArg == nil) \
106 SetErrorMessageAndAppendLongInt(theMessage,theLongInt); \
107 errCode = kGenericError; \
108 goto EXITPOINT; \
113 #define BailIfError(theErrCode) \
115 if ((theErrCode) != noErr) \
117 goto EXITPOINT; \
122 #define SetErrCodeAndBail(theErrCode) \
124 errCode = theErrCode; \
126 goto EXITPOINT; \
130 #define SetErrorCodeAndMessageAndBail(theErrCode,theMessage) \
132 SetErrorMessage(theMessage); \
133 errCode = theErrCode; \
134 goto EXITPOINT; \
138 #define BailNow() \
140 errCode = kGenericError; \
141 goto EXITPOINT; \
145 #ifdef __cplusplus
147 #endif