comparison tango/tango/core/Exception.di @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children f5ca6bbbf1d7
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
1 // D import file generated from 'core/Exception.d'
2 module tango.core.Exception;
3 private
4 {
5 alias void(* assertHandlerType)(char[] file, size_t line, char[] msg = null);
6 alias TracedExceptionInfo(* traceHandlerType)(void* ptr = null);
7 assertHandlerType assertHandler = null;
8 traceHandlerType traceHandler = null;
9 }
10 interface TracedExceptionInfo
11 {
12 int opApply(int delegate(ref char[]));
13 }
14 class OutOfMemoryException : Exception
15 {
16 this(char[] file, size_t line)
17 {
18 super("Memory allocation failed",file,line);
19 }
20 char[] toString()
21 {
22 return msg ? super.toString() : "Memory allocation failed";
23 }
24 }
25 class TracedException : Exception
26 {
27 this(char[] msg)
28 {
29 super(msg);
30 m_info = traceContext();
31 }
32 this(char[] msg, Exception e)
33 {
34 super(msg,e);
35 m_info = traceContext();
36 }
37 this(char[] msg, char[] file, size_t line)
38 {
39 super(msg,file,line);
40 m_info = traceContext();
41 }
42 char[] toString();
43 int opApply(int delegate(ref char[] buf) dg);
44 private
45 {
46 TracedExceptionInfo m_info;
47 }
48 }
49 class PlatformException : TracedException
50 {
51 this(char[] msg)
52 {
53 super(msg);
54 }
55 }
56 class AssertException : TracedException
57 {
58 this(char[] file, size_t line)
59 {
60 super("Assertion failure",file,line);
61 }
62 this(char[] msg, char[] file, size_t line)
63 {
64 super(msg,file,line);
65 }
66 }
67 class ArrayBoundsException : TracedException
68 {
69 this(char[] file, size_t line)
70 {
71 super("Array index out of bounds",file,line);
72 }
73 }
74 class FinalizeException : TracedException
75 {
76 ClassInfo info;
77 this(ClassInfo c, Exception e = null)
78 {
79 super("Finalization error",e);
80 info = c;
81 }
82 char[] toString()
83 {
84 assert(0);
85 }
86 }
87 class SwitchException : TracedException
88 {
89 this(char[] file, size_t line)
90 {
91 super("No appropriate switch clause found",file,line);
92 }
93 }
94 class TextException : TracedException
95 {
96 this(char[] msg)
97 {
98 super(msg);
99 }
100 }
101 class UnicodeException : TextException
102 {
103 size_t idx;
104 this(char[] msg, size_t idx)
105 {
106 super(msg);
107 this.idx = idx;
108 }
109 }
110 class ThreadException : PlatformException
111 {
112 this(char[] msg)
113 {
114 super(msg);
115 }
116 }
117 class FiberException : ThreadException
118 {
119 this(char[] msg)
120 {
121 super(msg);
122 }
123 }
124 class SyncException : PlatformException
125 {
126 this(char[] msg)
127 {
128 super(msg);
129 }
130 }
131 class IOException : PlatformException
132 {
133 this(char[] msg)
134 {
135 super(msg);
136 }
137 }
138 private
139 {
140 class VfsException : IOException
141 {
142 this(char[] msg)
143 {
144 super(msg);
145 }
146 }
147 }
148 private
149 {
150 class ClusterException : IOException
151 {
152 this(char[] msg)
153 {
154 super(msg);
155 }
156 }
157 }
158 class SocketException : IOException
159 {
160 this(char[] msg)
161 {
162 super(msg);
163 }
164 }
165 class HostException : IOException
166 {
167 this(char[] msg)
168 {
169 super(msg);
170 }
171 }
172 class AddressException : IOException
173 {
174 this(char[] msg)
175 {
176 super(msg);
177 }
178 }
179 class SocketAcceptException : SocketException
180 {
181 this(char[] msg)
182 {
183 super(msg);
184 }
185 }
186 class ProcessException : PlatformException
187 {
188 this(char[] msg)
189 {
190 super(msg);
191 }
192 }
193 class RegexException : TextException
194 {
195 this(char[] msg)
196 {
197 super(msg);
198 }
199 }
200 class LocaleException : TextException
201 {
202 this(char[] msg)
203 {
204 super(msg);
205 }
206 }
207 class RegistryException : TracedException
208 {
209 this(char[] msg)
210 {
211 super(msg);
212 }
213 }
214 class IllegalArgumentException : TracedException
215 {
216 this(char[] msg)
217 {
218 super(msg);
219 }
220 }
221 class IllegalElementException : IllegalArgumentException
222 {
223 this(char[] msg)
224 {
225 super(msg);
226 }
227 }
228 class NoSuchElementException : TracedException
229 {
230 this(char[] msg)
231 {
232 super(msg);
233 }
234 }
235 class CorruptedIteratorException : NoSuchElementException
236 {
237 this(char[] msg)
238 {
239 super(msg);
240 }
241 }
242 void setAssertHandler(assertHandlerType h)
243 {
244 assertHandler = h;
245 }
246 void setTraceHandler(traceHandlerType h)
247 {
248 traceHandler = h;
249 }
250 extern (C)
251 {
252 void onAssertError(char[] file, size_t line);
253 }
254 extern (C)
255 {
256 void onAssertErrorMsg(char[] file, size_t line, char[] msg);
257 }
258 TracedExceptionInfo traceContext(void* ptr = null);
259 extern (C)
260 {
261 void onArrayBoundsError(char[] file, size_t line);
262 }
263 extern (C)
264 {
265 void onFinalizeError(ClassInfo info, Exception ex);
266 }
267 extern (C)
268 {
269 void onOutOfMemoryError();
270 }
271 extern (C)
272 {
273 void onSwitchError(char[] file, size_t line);
274 }
275 extern (C)
276 {
277 void onUnicodeError(char[] msg, size_t idx);
278 }