Rewrite synopsis example of std.exception#6081
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
std/exception.d
Outdated
| { | ||
| mixin basicExceptionCtors; | ||
| } | ||
| assertThrown!MeaCulpa(enforce!MeaCulpa(0 == 1, "0 is not 1.")); |
There was a problem hiding this comment.
I would just show off construction
auto e = MeaCulpa("diagnostic message");
assert(e.msg == "diagnostic message");
assert(e.file == __FILE__);
assert(e.line == __LINE__ - 3);There was a problem hiding this comment.
OK, but I used throw. Otherwise there would be no point of using basicExceptionCtors ...
andralex
left a comment
There was a problem hiding this comment.
Please consider @JackStouffer's suggestion.
9227b5b to
78cd967
Compare
std/exception.d
Outdated
| module std.exception; | ||
|
|
||
| /// Synopis | ||
| unittest |
78cd967 to
5a93c63
Compare
std/exception.d
Outdated
| assert(e.file == __FILE__); | ||
| assert(e.line == __LINE__ - 3); | ||
|
|
||
| // doesPointTo can be used to check whether the source contains pointers / references |
There was a problem hiding this comment.
"The source"? Also, it doesn't just check for pointers/references, but ones pointing into the target. Perhaps this is best removed from the synopsis? The function doesn't really fit into std.exception anyway.
There was a problem hiding this comment.
The function doesn't really fit into std.exception anyway.
Excellent point (I was wondering about the same). Suggestions?
Probably stdx.allocator would probably be the best fit...
There was a problem hiding this comment.
Anyhow, I removed it for now and opened a Bugzilla issue: https://issues.dlang.org/show_bug.cgi?id=18387
2e7ee25 to
fc1e7ad
Compare
fc1e7ad to
36f80d3
Compare
|
Rebased to (I moved the discussion of the ill-fit |
It didn't compile (see #6080).
std.exception