Eliminated some problems resulting from last merge
[openstranded.git] / src / error.hh
blob502c0350fa6d0f67b2724cab79ad1f89d013f5f8
1 /*
2 * This file includes global error routines used throughout OpenStranded
4 * Copyright (C) 2008 Hermann Walth
6 * This file is part of OpenStranded
8 * OpenStranded is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
13 * OpenStranded is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with OpenStranded. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef STRANDED_ERROR_HH
23 #define STRANDED_ERROR_HH
25 #include <iostream>
26 #include <string>
27 #include <exception>
29 class StrandedException: public std::exception
31 private:
32 std::string message;
34 public:
35 StrandedException (const char* message);
36 StrandedException (const std::string& message);
37 ~StrandedException () throw ();
40 * This is a virtual method of the std::exception class
42 const char*
43 what () throw ();
45 virtual void
46 print ();
51 * OpenStranded uses a classical Warning - Error - Fatal
52 * exception level scheme.
53 * You should use the following classes instead of
54 * their StrandedException base class
58 * NOTE: Implementation of warnings through exceptions is somewhat difficult,
59 * for you will most probably want to continue your function without disruption
60 * after throwing a Warning, exceptions will, however,
61 * always break out of the function
62 * Therefore you should not throw this exception
63 * unless there is another approach to this problem
65 class StrandedWarning: public StrandedException
67 public:
68 StrandedWarning (const char* message);
69 StrandedWarning (const std::string& message);
71 void
72 print ();
76 class StrandedError: public StrandedException
78 public:
79 StrandedError (const char* message);
80 StrandedError (const std::string& message);
82 void
83 print ();
87 class StrandedFatal: public StrandedException
89 public:
90 StrandedFatal (const char* message);
91 StrandedFatal (const std::string& message);
93 void
94 print ();
97 #endif /* STRANDED_ERROR_HH */