On Tuesday, 29 January 2013 at 20:37:07 UTC, Andrej Mitrovic wrote:
On 1/29/13, Vladimir Panteleev <vladi...@thecybershadow.net> wrote:
foreach (lineNumber, line; lines)
    try
       numbers ~= to!int(line);
    catch (Exception e)
       throw new Exception(format("Error on line %d: %s",
lineNumber, e.msg));

Of course, this has the problem that all information (except the
message) from the original exception is lost.

What I'd do is:

catch (Exception e)
{
    e.msg = format("My info here...\n%s", e.msg);
    throw e;
}

Ah, that's clever... thanks!

Reply via email to