hx:27: Called from CallStack method traceStack
Called from CallStack method multiply
Called from CallStack method minus
Called from CallStack method add
Called from CallStack method main
Reading backward through the stack, you can see that you started at the method main in the CallStack
class. From there, the add method was called. That method then called the minus method, which in turn
called the multiply method, which finally called the traceStack() method. Although you could
easily have recreated this scenario with a trace call in each method, the callStack() function has
enabled you to print this information cleanly, without having to write extra code in multiple locations.
What ??™ s more, you can guarantee that no method in the call stack is left out.
haxe.Stack.exceptionStack()
The exceptionStack function works in a very similar fashion to the callStack() function. However,
while the callStack() function is intended for use as a way to track which methods are called from the
base class to the moment the callStack() function is called, the exceptionStack() function is used
to trace the journey from the method where an exception is thrown to the method where the
exceptionStack() function is called:
class ExceptionStack
{
public static function main()
{
try
{
var i : Int = 0;
i = add( i, 6 );
}
catch ( err : Dynamic )
{
var es = haxe.
Pages:
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387