I'm playing with it a little bit and it seems that it doesn't exactly work. Running this program
try {
throw "Boo!";
} catch (e, s) {
print("Caught: $e");
print("Stack: $s");
}
}
produces
Caught: Boo!
Stack: #0 boo (file:///home/ladicek/work/dart/projects/playground/stack.dart:3:5)
on this version of standalone Dart VM:
ladicek@argondie:~/work/dart/projects/playground$ dart --version
Dart VM version: 0.1.2.0_r16973 (Fri Jan 11 06:09:19 2013)
I know there was at least one discussion about this, whether the stacktrace should contain only those stack frames between the throw and the catch or all frames on the stack. Right now, it seems to be the first variant, but I believe that the spec says that it should be the second one; see 13.10:
The active stack trace is an object whose toString() method produces a string that is a record of exactly those function activations within the current isolate that had not completed execution at the point where the current exception was thrown.
Oh, and I actually found bugs filed! If anyone is interested:
LT