From 8ab7e935913c102fb039110e20b71f698a68c6ee Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 16 Jun 2016 01:49:06 -0400 Subject: step5 sdlang used for config files and doc headers --- src/sdlang/exception.d | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/sdlang/exception.d (limited to 'src/sdlang/exception.d') diff --git a/src/sdlang/exception.d b/src/sdlang/exception.d new file mode 100644 index 0000000..e87307f --- /dev/null +++ b/src/sdlang/exception.d @@ -0,0 +1,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); } +} -- cgit v1.2.3