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 #1445 from WalterBright/message
Browse files Browse the repository at this point in the history
Add message() to object.Throwable
  • Loading branch information
andralex committed Dec 16, 2015
2 parents c36cc51 + 2fbe4a8 commit 74e5d87
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/object.d
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@ class Throwable : Object
sink("@"); sink(file);
sink("("); sink(sizeToTempString(line, tmpBuff, 10)); sink(")");

auto msg = message();
if (msg.length)
{
sink(": "); sink(msg);
Expand All @@ -1678,6 +1679,19 @@ class Throwable : Object
}
}
}

/**
* Get the message describing the error.
* Base behavior is to return the `Throwable.msg` field.
* Override to return some other error message.
*
* Returns:
* message
*/
const(char)[] message() const
{
return msg;
}
}


Expand Down

0 comments on commit 74e5d87

Please sign in to comment.