cfl_exception.h
Go to the documentation of this file.
1/** @file cfl_exception.h Class Exception */
2
3/* FAU Discrete Event Systems Library (libfaudes)
4
5 Copyright (C) 2006 Bernd Opitz
6 Exclusive copyright is granted to Klaus Schmidt
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public
10 License as published by the Free Software Foundation; either
11 version 2.1 of the License, or (at your option) any later version.
12
13 This library 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 GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public
19 License along with this library; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
21
22
23#ifndef FAUDES_EXCEPTION_H
24#define FAUDES_EXCEPTION_H
25
26#include "cfl_definitions.h"
27#include "cfl_utils.h"
28#include <exception>
29#include <string>
30
31namespace faudes {
32
33/**
34 * Faudes exception class. libFAUDES uses the C++ exception mechanism to
35 * report errors on file IO and all sorts of invalid arguments. Members are
36 *
37 * @param Function
38 * Function name (where did the exception happen)
39 * @param Description
40 * Detailed description (human readable comment)
41 * @param ErrorId
42 * Error id (numeric id, see below)
43
44 * Define the compiletime option FAUDES_DEBUG_EXCEPTIONS
45 * to enable verbose output when exceptions are thrown, including those that are catched
46 * on another level. Define the compiletime option FAUDES_CHECKED to turn
47 * on argument validation on both internal and user functions.
48 *
49 *
50 *
51 * (File-) System Errors
52 *
53 * - 0: Error not defined or no error id given
54 * - 1: ios::failure thrown while opening/reading/seeking file
55 * - 2: ios::failure thrown while opening/writing file
56 * - 3: error on in systemcall (eg dot)
57 *
58 * Symboltable Errors
59 *
60 * - 40: SymbolTable - overflow
61 * - 41: SymbolTable - attempt to insert or set name which already exists
62 * - 42: SymbolTable - attempt to insert or set index which already exists
63 * - 43: SymbolTable - attempt to insert or set invalid name
64 *
65 * Runtime interface error
66 *
67 * - 45: Registry - attempt to insert invalid entry
68 * - 46: Registry - attempt to access non existent entry
69 * - 47: Registry - parameter index out of range
70 * - 48: Registry - type check error
71 * - 49: Registry - function execution error
72 *
73 * Token IO Errors
74 *
75 * - 50: TokenReader: token mismatch
76 * - 51: TokenReader: label not found
77 * - 52: TokenReader: unbalanced SeekEnd()
78 *
79 * Container Classes Errors
80 *
81 * - 60: IndexSet: index not found (eg. when accessing attribute)
82 * - 61: IndexSet: attempt to insert invalid index 0
83 * - 62: BaseSet: invalid iterator
84 * - 63: BaseSet: invalid attribute access
85 * - 65: NameSet: referring to index with no symbolic name
86 * - 66: NameSet: referring unknown symbolic name
87 * - 67: NameSet: symboltable mismatch
88 * - 68: TransSet: order mismatch
89 * - 69: BaseVector: invalid index
90 *
91 * Core Generator Classes Errors
92 *
93 * - 80: Generator: reading invalid stateset
94 * - 85: Generator: reading invalid transition set
95 * - 88: Generator: symbol table mismatch
96 * - 89: Generator: referring to unkown event name
97 * - 90: Generator: referring to unkown state name
98 * - 91: Generator: setting transition/initial/marked property for unkown state
99 * - 92: Generator: initial state does not exist uniquely
100 * - 95: Generator: transition referring to unknown states/event
101 * - 96: Generator: source must not match destination
102 * - 99: Generator: internal validity check failed
103 *
104 *
105 * Generator Operation Errors
106 *
107 * - 100: Alphabet mismatch
108 * - 101: Nondeterministic argument
109 * - 110: Break on application request
110 * - 1xx See respective functions
111 * - 2xx See respective functions
112 *
113 * Exception ids between 300 and 999 are used by LRT plugins.
114 *
115 * - 55x IODevice
116 *
117 */
118class FAUDES_API Exception : public std::exception {
119 public:
120 /**
121 * Constructor
122 *
123 * Writes an error message on stderr and throws an exception.
124 *
125 * @param rFunctionName
126 * Function name (where did the exception happen)
127 * @param rDescription
128 * Detailed error description
129 * @param errorId
130 * Error id
131 * @param mute
132 * when true, mute console output
133 * (this is meant for threaded applications where console out may be an issue)
134 */
135 explicit Exception(const std::string& rFunctionName,
136 const std::string& rDescription, unsigned int errorId, bool mute=false);
137
138 /** Destructor */
139 virtual ~Exception() throw();
140
141 /** Returns Function */
142 virtual const char* Where() const throw();
143
144 /** Returns error description */
145 virtual const char* What() const throw();
146
147 /** Returns error description */
148 virtual const char* Message() const throw();
149
150 /** Returns error id */
151 virtual unsigned int Id() const throw();
152
153 private:
154 /** Function name */
155 std::string mFunctionName;
156
157 /** Error description */
158 std::string mDescription;
159
160 /** Error message */
161 std::string mMessage;
162
163 /** Error id */
164 unsigned int mErrorId;
165};
166
167} // namespace faudes
168
169#endif
#define FAUDES_API
std::string mDescription
unsigned int mErrorId
std::string mFunctionName
std::string mMessage

libFAUDES 2.33k --- 2025.09.16 --- c++ api documentaion by doxygen