Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #835 from jmdavis/exception
Browse files Browse the repository at this point in the history
Add missing constructor to core.time.TimeException.
  • Loading branch information
MartinNowak committed Jun 12, 2014
2 parents 6b165e4 + f053a4f commit 6e4ab34
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/core/time.d
Original file line number Diff line number Diff line change
Expand Up @@ -3270,10 +3270,42 @@ class TimeException : Exception
line = The line number where the exception occurred.
next = The previous exception in the chain of exceptions, if any.
+/
@safe pure nothrow this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null)
this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) @safe pure nothrow
{
super(msg, file, line, next);
}

/++
Params:
msg = The message for the exception.
next = The previous exception in the chain of exceptions.
file = The file where the exception occurred.
line = The line number where the exception occurred.
+/
this(string msg, Throwable next, string file = __FILE__, size_t line = __LINE__) @safe pure nothrow
{
super(msg, file, line, next);
}
}

unittest
{
{
auto e = new TimeException("hello");
assert(e.msg == "hello");
assert(e.file == __FILE__);
assert(e.line == __LINE__ - 3);
assert(e.next is null);
}

{
auto next = new Exception("foo");
auto e = new TimeException("goodbye", next);
assert(e.msg == "goodbye");
assert(e.file == __FILE__);
assert(e.line == __LINE__ - 3);
assert(e.next is next);
}
}


Expand Down

0 comments on commit 6e4ab34

Please sign in to comment.