Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- import core.exception;
- void foo()
- {
- scope(exit) throw new AssertError("Assert 2");
- throw new AssertError("Assert 1");
- }
- void printThrowable(Throwable t)
- {
- writeln(t.msg);
- if (t.next)
- {
- writeln("printing chain:");
- printThrowable(t.next);
- }
- if (cast(Error)t)
- {
- auto e = cast(Error)t;
- if (e.bypassedException)
- {
- writeln("printing bypassed:");
- printThrowable(e.bypassedException);
- }
- }
- }
- void main()
- {
- try
- {
- foo();
- }
- catch (Throwable t)
- {
- t.printThrowable;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement