Skip to content

Instantly share code, notes, and snippets.

@JakobOvrum
Created October 3, 2013 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakobOvrum/6816017 to your computer and use it in GitHub Desktop.
Save JakobOvrum/6816017 to your computer and use it in GitHub Desktop.
ExceptionConstructor mixin template
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