PageRenderTime 25ms CodeModel.GetById 18ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/core/error.d

http://github.com/wilkie/djehuty
D | 49 lines | 27 code | 9 blank | 13 comment | 0 complexity | e532f395f9ec67b100835d3e85e923e6 MD5 | raw file
 1/*
 2 * error.d
 3 *
 4 * This module implements the Error objects useable by the system.
 5 * This objects are for irrecoverable failures.
 6 *
 7 * Originated: May 8th, 2010
 8 *
 9 */
10
11module core.error;
12
13import core.definitions;
14
15// Description: This is for non irrecoverable failure.
16class Error : Exception {
17	this(string msg, string file = "", ulong line = 0) {
18		super(msg, file, line);
19	}
20
21private:
22//	Error _next;
23}
24
25abstract class RuntimeError : Error {
26	this(string msg, string file, ulong line){
27		super(msg,file,line);
28	}
29
30static:
31
32	// Description: This Error is thrown when assertions fail.
33	class Assert : RuntimeError {
34		this(string msg, string file, ulong line) {
35			super("Assertion `" ~ msg ~ "` failed", file, line);
36		}
37
38		this(string file, ulong line) {
39			super("Assertion failed",file,line);
40		}
41	}
42
43	// Description: This Error is thrown when a switch statement does not have a default and there is no case available.
44	class NoDefaultCase : RuntimeError {
45		this(string file, ulong line) {
46			super("Switch has no default",file,line);
47		}
48	}
49}