source: cheroxy/trunk/include/CRXException.h@ 24

Last change on this file since 24 was 24, checked in by cheese, 12 years ago

#1 change response, threading and proxy work-flow

File size: 1.3 KB
Line 
1/**
2 * CRXException.h
3 */
4#ifndef __CRXEXCEPTION_H__
5#define __CRXEXCEPTION_H__
6
7#include <string>
8#include <stdarg.h>
9
10#ifdef _WIN32
11# define __func__ __FUNCTION__
12#endif
13
14#define CRX_ERROR(__CODE,__FMT,...) \
15 do { \
16 SetErrorCode (__CODE); \
17 SetErrorMessage (__FILE__,__func__,__LINE__,__FMT,##__VA_ARGS__); \
18 } while (0)
19
20#define CRX_ERROR_ADD(__MESSAGE) \
21 do { \
22 AddMessage (__MESSAGE); \
23 } while (0)
24
25class CRXException
26{
27private:
28 std::string mMessage;
29 int mCode;
30
31public:
32 CRXException (void);
33 virtual ~CRXException (void);
34
35public:
36 /* get */
37 int GetErrorCode (void) const;
38
39 std::string GetErrorMessage (void) const;
40
41 int GetSystemErrorCode (void) const;
42
43 /* set */
44 void SetErrorCode (const int aCode);
45
46 void SetErrorMessage (const char * aFile,
47 const char * aFunction,
48 const int aLine,
49 const char * aFormat, ...);
50
51 std::string MakeErrorMessage (const char * aFile,
52 const char * aFunction,
53 const int aLine,
54 const char * aFormat,
55 va_list aVaList);
56
57 void AddMessage (const char * aMessage);
58};
59
60#endif // #ifndef __CRXEXCEPTION_H__
Note: See TracBrowser for help on using the repository browser.