author | Michael Krelin <hacker@klever.net> | 2007-12-30 21:55:36 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2008-01-04 18:23:09 (UTC) |
commit | 9e46475efea0f61bc588221d21d0d749c4eb7ab1 (patch) (unidiff) | |
tree | 472a840a9df3209ebcb1909dc40b0b08a50bbb3d | |
parent | 40303fc819bc509f5593bf07c082f3d116023c18 (diff) | |
download | libopkele-9e46475efea0f61bc588221d21d0d749c4eb7ab1.zip libopkele-9e46475efea0f61bc588221d21d0d749c4eb7ab1.tar.gz libopkele-9e46475efea0f61bc588221d21d0d749c4eb7ab1.tar.bz2 |
exception fixes and enhancements
Signed-off-by: Michael Krelin <hacker@klever.net>
-rw-r--r-- | include/opkele/exception.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/opkele/exception.h b/include/opkele/exception.h index 8913665..36bd07a 100644 --- a/include/opkele/exception.h +++ b/include/opkele/exception.h | |||
@@ -1,78 +1,86 @@ | |||
1 | #ifndef __OPKELE_EXCEPTION_H | 1 | #ifndef __OPKELE_EXCEPTION_H |
2 | #define __OPKELE_EXCEPTION_H | 2 | #define __OPKELE_EXCEPTION_H |
3 | 3 | ||
4 | /** | 4 | /** |
5 | * @file | 5 | * @file |
6 | * @brief opkele exceptions | 6 | * @brief opkele exceptions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <curl/curl.h> | 9 | #include <curl/curl.h> |
10 | 10 | ||
11 | #include <opkele/opkele-config.h> | 11 | #include <opkele/opkele-config.h> |
12 | #ifdef OPKELE_HAVE_KONFORKA | 12 | #ifdef OPKELE_HAVE_KONFORKA |
13 | # include <konforka/exception.h> | 13 | # include <konforka/exception.h> |
14 | /** | 14 | /** |
15 | * the exception parameters declaration | 15 | * the exception parameters declaration |
16 | */ | 16 | */ |
17 | # define OPKELE_E_PARS const string& fi,const string&fu,int l,const string& w | 17 | # define OPKELE_E_PARS const string& fi,const string&fu,int l,const string& w |
18 | /** | 18 | /** |
19 | * the exception parameters list to pass to constructor | 19 | * the exception parameters list to pass to constructor |
20 | */ | 20 | */ |
21 | # define OPKELE_E_CONS_ fi,fu,l, | 21 | # define OPKELE_E_CONS_ fi,fu,l, |
22 | /** | 22 | /** |
23 | * the exception codepoint specification | 23 | * the exception codepoint specification |
24 | */ | 24 | */ |
25 | # define OPKELE_CP_ CODEPOINT, | 25 | # define OPKELE_CP_ CODEPOINT, |
26 | /** | 26 | /** |
27 | * open function-try-block | ||
28 | */ | ||
29 | # define OPKELE_FUNC_TRY try | ||
30 | /** | ||
27 | * the simple rethrow of konforka-based exception | 31 | * the simple rethrow of konforka-based exception |
28 | */ | 32 | */ |
29 | # define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw } | 33 | # define OPKELE_RETHROW catch(konforka::exception& e) { e.see(CODEPOINT); throw; } |
30 | #else /* OPKELE_HAVE_KONFORKA */ | 34 | #else /* OPKELE_HAVE_KONFORKA */ |
31 | # include <exception> | 35 | # include <exception> |
32 | # include <string> | 36 | # include <string> |
33 | /** | 37 | /** |
34 | * the exception parameter declaration | 38 | * the exception parameter declaration |
35 | */ | 39 | */ |
36 | # define OPKELE_E_PARS const string& w | 40 | # define OPKELE_E_PARS const string& w |
37 | /** | 41 | /** |
38 | * the dummy prefix for exception parameters list to prepend in the absence of | 42 | * the dummy prefix for exception parameters list to prepend in the absence of |
39 | * konforka library | 43 | * konforka library |
40 | */ | 44 | */ |
41 | # define OPKELE_E_CONS_ | 45 | # define OPKELE_E_CONS_ |
42 | /** | 46 | /** |
43 | * the dummy placeholder for konforka exception codepoint specification | 47 | * the dummy placeholder for konforka exception codepoint specification |
44 | */ | 48 | */ |
45 | # define OPKELE_CP_ | 49 | # define OPKELE_CP_ |
46 | /** | 50 | /** |
51 | * the dummy define for the opening function-try-block | ||
52 | */ | ||
53 | # define OPKELE_FUNC_TRY | ||
54 | /** | ||
47 | * the dummy define for the konforka-based rethrow of exception | 55 | * the dummy define for the konforka-based rethrow of exception |
48 | */ | 56 | */ |
49 | # define OPKELE_RETHROW | 57 | # define OPKELE_RETHROW |
50 | #endif /* OPKELE_HAVE_KONFORKA */ | 58 | #endif /* OPKELE_HAVE_KONFORKA */ |
51 | /** | 59 | /** |
52 | * the exception parameters list to pass to constructor | 60 | * the exception parameters list to pass to constructor |
53 | */ | 61 | */ |
54 | # define OPKELE_E_CONS OPKELE_E_CONS_ w | 62 | # define OPKELE_E_CONS OPKELE_E_CONS_ w |
55 | 63 | ||
56 | namespace opkele { | 64 | namespace opkele { |
57 | using std::string; | 65 | using std::string; |
58 | 66 | ||
59 | /** | 67 | /** |
60 | * the base opkele exception class | 68 | * the base opkele exception class |
61 | */ | 69 | */ |
62 | class exception : public | 70 | class exception : public |
63 | # ifdef OPKELE_HAVE_KONFORKA | 71 | # ifdef OPKELE_HAVE_KONFORKA |
64 | konforka::exception | 72 | konforka::exception |
65 | # else | 73 | # else |
66 | std::exception | 74 | std::exception |
67 | # endif | 75 | # endif |
68 | { | 76 | { |
69 | public: | 77 | public: |
70 | # ifdef OPKELE_HAVE_KONFORKA | 78 | # ifdef OPKELE_HAVE_KONFORKA |
71 | explicit | 79 | explicit |
72 | exception(const string& fi,const string& fu,int l,const string& w) | 80 | exception(const string& fi,const string& fu,int l,const string& w) |
73 | : konforka::exception(fi,fu,l,w) { } | 81 | : konforka::exception(fi,fu,l,w) { } |
74 | # else /* OPKELE_HAVE_KONFORKA */ | 82 | # else /* OPKELE_HAVE_KONFORKA */ |
75 | string _what; | 83 | string _what; |
76 | explicit | 84 | explicit |
77 | exception(const string& w) | 85 | exception(const string& w) |
78 | : _what(w) { } | 86 | : _what(w) { } |