diff options
author | Ralph Amissah <ralph@amissah.com> | 2016-06-16 01:49:06 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2019-04-04 14:48:18 -0400 |
commit | 8ab7e935913c102fb039110e20b71f698a68c6ee (patch) | |
tree | 3472debd16ce656a57150399ce666e248565f011 /src/sdlang/exception.d | |
parent | step4.1 as step4 but extract header meta & make on first reading in document (diff) |
step5 sdlang used for config files and doc headers
Diffstat (limited to 'src/sdlang/exception.d')
-rw-r--r-- | src/sdlang/exception.d | 42 |
1 files changed, 42 insertions, 0 deletions
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); } +} |