Plug more leaks (in the test, not the core)
[gnash.git] / libbase / GnashException.h
blobf285bf5c5f8458b45af45fc798bafe899113afa2
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
3 // Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef GNASH_GNASHEXCEPTION_H
20 #define GNASH_GNASHEXCEPTION_H
22 #include <stdexcept>
23 #include <string>
24 #include "dsodefs.h"
26 namespace gnash
29 /// Top-level gnash exception
30 class DSOEXPORT GnashException: public std::runtime_error
33 public:
35 GnashException(const std::string& s)
37 std::runtime_error(s)
40 GnashException()
42 std::runtime_error("Generic error")
45 virtual ~GnashException() throw() {}
48 /// An exception from MediaHandler subsystem
49 class DSOEXPORT MediaException : public GnashException
52 public:
54 MediaException(const std::string& s)
56 GnashException(s)
59 MediaException()
61 GnashException("Media error")
64 virtual ~MediaException() throw() {}
68 /// An exception from SoundHandler subsystem
69 class DSOEXPORT SoundException : public GnashException
72 public:
74 SoundException(const std::string& s)
76 GnashException(s)
79 SoundException()
81 GnashException("Audio error")
84 virtual ~SoundException() throw() {}
88 /// An SWF parsing exception
89 class DSOEXPORT ParserException : public GnashException
92 public:
94 ParserException(const std::string& s)
96 GnashException(s)
99 ParserException()
101 GnashException("Parser error")
104 virtual ~ParserException() throw() {}
108 /// An ActionScript error exception
109 class ActionException: public GnashException
112 protected:
114 ActionException(const std::string& s)
116 GnashException(s)
119 ActionException()
121 GnashException("ActionScript error")
124 public:
126 virtual ~ActionException() throw() {}
130 /// An ActionScript limit exception
132 /// When this exception is thrown, current execution should
133 /// be aborted, stacks and registers cleaning included.
135 class ActionLimitException: public ActionException
138 public:
140 ActionLimitException(const std::string& s)
142 ActionException(s)
145 ActionLimitException()
147 ActionException("ActionScript limit hit")
150 virtual ~ActionLimitException() throw() {}
154 /// An ActionScript type error
156 /// This exception can be thrown by as_value::to_primitive when an object
157 /// can't be converted to a primitive value or by native function when
158 /// they are called as method of an unexpected type
160 class ActionTypeError: public ActionException
163 public:
165 ActionTypeError(const std::string& s)
167 ActionException(s)
170 ActionTypeError()
172 ActionException("ActionTypeError")
175 virtual ~ActionTypeError() throw() {}
179 /// An action parsing error, thrown on illegal
180 /// action buffer access.
181 class ActionParserException: public ActionException
184 public:
186 ActionParserException(const std::string& s)
188 ActionException(s)
191 ActionParserException()
193 ActionException("Action parser exception")
196 virtual ~ActionParserException() throw() {}
200 /// An unhandled exception in ActionScript, which should
201 /// interrupt code execution.
202 class ActionScriptException: public ActionException
205 public:
207 ActionScriptException(const std::string& s)
209 ActionException(s)
212 ActionScriptException()
214 ActionException("Unhandled ActionScript exception")
217 virtual ~ActionScriptException() throw() {}
222 } // namespace gnash
224 #endif // def GNASH_GNASHEXCEPTION_H
227 // Local Variables:
228 // mode: C++
229 // c-basic-offset: 8
230 // tab-width: 8
231 // indent-tabs-mode: t
232 // End: