aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sdlang/exception.d
blob: e87307f98850444dc1a4967861793a160778d187 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SDLang-D
// Written in the D programming language.

module sdlang.exception;

import std.exception;
import std.string;

import sdlang.util;

abstract class SDLangException : Exception
{
	this(string msg) { super(msg); }
}

class SDLangParseException : SDLangException
{
	Location location;
	bool hasLocation;

	this(string msg)
	{
		hasLocation = false;
		super(msg);
	}

	this(Location location, string msg)
	{
		hasLocation = true;
		super("%s: %s".format(location.toString(), msg));
	}
}

class SDLangValidationException : SDLangException
{
	this(string msg) { super(msg); }
}

class SDLangRangeException : SDLangException
{
	this(string msg) { super(msg); }
}