Created
October 3, 2013 19:50
-
-
Save JakobOvrum/6816017 to your computer and use it in GitHub Desktop.
ExceptionConstructor mixin template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mixin template ExceptionConstructor() | |
{ | |
@safe pure nothrow | |
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) | |
{ | |
super(msg, file, line, next); | |
} | |
} | |
mixin template ExceptionConstructor(string defaultMessage) | |
{ | |
@safe pure nothrow | |
this(string msg = defaultMessage, string file = __FILE__, size_t line = __LINE__, Throwable next = null) | |
{ | |
super(msg, file, line, next); | |
} | |
} | |
class MyException : Exception | |
{ | |
mixin ExceptionConstructor!(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment