author | jacint |
Wed, 05 May 2004 17:29:41 +0000 | |
changeset 536 | c050de070935 |
child 542 | 69bde1d90c04 |
permissions | -rw-r--r-- |
1 #include <iostream>
3 #include <error.h>
5 using namespace hugo;
6 using std::cout;
7 using std::endl;
9 void faulty_fn() {
10 fault("This is a fault message");
11 }
13 void exception_fn() {
14 throw Exception("This is a fn throwing excpt with some args: ")
15 << 5 << ", " << 18;
16 }
18 void unfinished_fn() {
19 FIXME("unfinished_fn() is unfinished!");
20 }
23 int main() {
24 bool no_errors = false;
26 try {
27 cout << "Trying a faulty function\n";
28 faulty_fn();
29 no_errors = true;
30 cout << "FAILED!\n";
31 }
32 catch(const Exception &e) {
33 cout << "E: " << e.what() << endl;
34 }
36 try {
37 cout << "Trying a function throwing Exception\n";
38 exception_fn();
39 no_errors = true;
40 cout << "FAILED!\n";
41 }
42 catch(const Exception &e) {
43 cout << "E: " << e.what() << endl;
44 }
46 try {
47 cout << "Trying a function using FIXME\n";
48 unfinished_fn();
49 no_errors = true;
50 cout << "FAILED!\n";
51 }
52 catch(const Exception &e) {
53 cout << "E: " << e.what() << endl;
54 }
56 return no_errors ? 1 : 0;
57 }